Repository navigation
ImageScript 4.0.1 is a performance release. There are no API changes, and every image decodes to the same pixels as in 4.0.0.
Faster decoding
- TIFF: 1.5 to 4.5 times faster for 8- and 16-bit gray and RGB images (a 4000x2667 RGB image: 136 to 45 ms uncompressed, 311 to 154 ms with deflate). LZW-compressed files are about 15% faster.
- JPEG: baseline files are 8 to 15% faster, and 4:2:0 and 4:2:2 files another 5 to 7%. Progressive files are 1.2 to 1.5 times faster (6000x4000: 1529 to 1250 ms).
- WebP: lossless files are 18 to 29% faster, lossy files 3 to 14%.
- PNG: palette and grayscale files are 1.2 to 1.7 times faster.
Faster processing and encoding
- PNG encoding is 2 to 4 times faster for large images in Node.js and Bun: the data is compressed in parts on several threads (a 4000x2667 photo: 655 to 265 ms in Node.js, 601 to 157 ms in Bun). Encoding opaque truecolor images is also 4 to 8% faster.
quantize()is up to 2.3 times faster without dithering, 1.4 times with'ordered'and 1.2 times with'atkinson'.composite()is up to 1.5 times faster for opaque sources.
Good to know
PNG files from encodePNG() can differ in their bytes from 4.0.0's: they are still valid PNGs with the same pixels, and often a few bytes smaller or larger. If you compare encoder output by hash, expect a new hash for PNG. All other encoders produce the same bytes as before.
The changelog has the details and measurements.