Skip to content

3.12.2

Choose a tag to compare

@matmen matmen released this 31 Oct 00:43
Immutable release. Only release title and notes can be modified.

This release makes JPEG encoding about 30% faster and byte for byte identical to libjpeg-turbo, and gives ImageScript a logo. There are no API changes.

await image.encodeJPEG(90);   // the same bytes as cjpeg -quality 90 -baseline -optimize (but for the Exif segment)

JPEG encoding like libjpeg-turbo

encodeJPEG() now uses libjpeg-turbo's integer pipeline instead of floating point: its color conversion, chroma downsampling, DCT and quantization, including how it pads partial blocks at the image's edges. The files are exactly what cjpeg -quality <q> -baseline -optimize writes (with -sample 1x1 above quality 90), apart from our Exif segment. Over 490 test encodes at every quality, all were identical, and the tests check this against cjpeg's output.

  • About 30% faster: the integer pipeline, chroma converted and subsampled two rows at a time (16 MB less memory for a 1920x1080 image) and leaner entropy coding.
  • Slightly different files: photos come out 0.1-1% larger at the same quality. Rendered images (screenshots, graphics) at quality 90 and above can be up to 9% larger, mostly because libjpeg rounds the color samples to 8 bits. These are the same files sharp, Pillow and other libjpeg-based tools produce.

JPEG decoding now upsamples chroma a row at a time while converting to RGB, about 6 MB less memory for a 1920x1080 image, with the same pixels and speed.

Logo

ImageScript has a logo: it heads the README on GitHub, npm and JSR, and the documentation at imagescript.dev now has a favicon and shows a preview with the logo when you share a link.

See the changelog for the details.