gitmyhub

rastermill

TypeScript ★ 32 updated 21d ago

Fast, portable image processing for Node agents.

Rastermill is a Node.js library for processing images on the server side. It is aimed at developers building automated systems or AI agents that need to handle images as part of their workflow, rather than at end users working interactively.

The library provides three core operations. The probe method reads basic information from an image, such as its format, dimensions, and file size, without decoding the entire file. The transparency method checks whether an image has an alpha channel and whether any pixels are actually transparent, which are two different things. The encode method does the main work: it can resize an image, convert it to a different format, strip metadata, and search for a file size within a specified byte budget.

Rastermill uses a library called Photon to do image work inside the running process without spawning external programs. For formats that Photon cannot handle, it can fall back to native tools already installed on the machine, such as ImageMagick, GraphicsMagick, ffmpeg, or the macOS-native sips command. You can also force it to use only the internal approach, or only external tools. WebP quality control, for example, requires an external backend because the internal Photon encoder does not support quality settings.

The library sets configurable limits on the pixel count of both input and output images, and refuses to process images that exceed those limits or have unknown dimensions. Metadata like location data and camera settings is stripped by default during any transform, because the internal processing library does not have APIs to carry that data through.

The README is short and focused on API reference. There is no description of pricing, licensing terms, or installation steps beyond the import example.