Registry / testing / rastermill

rastermill

JSON →
library0.3.1jsnpmunverified

Rastermill is a fast, portable image processing library for Node.js agents, currently at version 0.3.1. It uses Photon for in-process image operations and can fall back to native tools (sips, ImageMagick, GraphicsMagick, ffmpeg) for formats like HEIC/AVIF. Key differentiators: configurable pixel limits for safety, automatic format detection and metadata stripping, and support for auto-orientation. Types are shipped. Requires Node >= 22. Release cadence is not specified.

npm install rastermill
INSTALL
IMPORT
SIG · RASTERMILL
R
rastermill
testingjavascriptv0.3.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createRastermill
import { createRastermill } from 'rastermill'
const createRastermill = require('rastermill')
ESM only since v0.1.0; CJS require will fail.
probe
import { probe } from 'rastermill'
Same ESM restriction. Available as named export.
encode
import { encode } from 'rastermill'
Standalone function backed by default lazy instance.
transparency
import { transparency } from 'rastermill'
Reports separate hasAlphaChannel and hasTransparentPixels.

Create a Rastermill instance, probe an image, and encode it as JPEG with resize and quality.

import { createRastermill } from 'rastermill'; import { readFile } from 'node:fs/promises'; const rastermill = createRastermill({ execution: 'auto', limits: { inputPixels: 25000000, outputPixels: 25000000 }, }); const imageBuffer = await readFile('input.heic'); const info = await rastermill.probe(imageBuffer); console.log(info.format, info.width, info.height); const jpeg = await rastermill.encode(imageBuffer, { format: 'jpeg', resize: { maxSide: 1600 }, quality: 85, }); console.log(jpeg.mimeType, jpeg.bytes);
Debug
Known issues
breakingEngine requirement: Node >= 22. Older versions will not work.
fix
Upgrade to Node 22 or later.
affects: <0.1.0
deprecatedPhoton does not expose EXIF/GPS/ICC/XMP APIs; metadata preservation is limited.
fix
Use metadata: 'preserve' only when no transform is applied; otherwise metadata is stripped.
affects: >=0.1.0
gotchaWebP quality control requires an external backend (e.g., cwebp) because Photon's WebP encoder does not accept quality setting.
fix
Set execution: 'auto' or 'external' to use native tools for WebP.
affects: >=0.1.0
breakingESM only; CJS require() will throw Module not found.
fix
Use import syntax or dynamic import.
affects: >=0.1.0
gotchaencode() may succeed but return an empty buffer if input pixel limit is exceeded; error handling needed.
fix
Check response.bytes > 0 or catch probe/encode errors.
affects: >=0.1.0
Errors
Common errors & fixes
SyntaxError: The requested module 'rastermill' does not provide an export named 'createRastermill'
Using CommonJS require instead of ESM import.
fix
Change require('rastermill') to import { createRastermill } from 'rastermill', or use dynamic import.
Error: Unsupported format
Input image format not recognized or not supported by any backend.
fix
Check the input buffer or file; supported formats: HEIC, JPEG, PNG, WebP, AVIF, etc. Ensure external tools are installed if needed.
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
rastermill — npm install rastermill · libregistry