Skip to content

4.0.0-rc.6

Pre-release
Pre-release

Choose a tag to compare

@matmen matmen released this 20 Nov 02:48
Immutable release. Only release title and notes can be modified.

ImageScript 4.0.0-rc.6

The sixth and last release candidate for ImageScript 4.0 is ready for evaluation. This is a major release with breaking API
changes from 3.x. Before upgrading, update to the latest 3.x release (3.20.5) and address its deprecation warnings, then
follow the migration guide.
The full list of changes is in the changelog.

This release candidate is about robustness: documents, fonts and options that are hostile or just very large are bounded
or refused with a clear error instead of running the process out of memory or time, and error messages say what they got.

Changes since rc.5

  • SVG and text limits: renderSVG() bounds the work it does for paths (arcs between far-apart points, path data, <use>
    copies, <textPath>), glyph outlines, filters, painted pixels and markers, and throws a LimitError. renderText()
    bounds decoding, scaling and rasterizing glyphs the same way, and keeps what it caches for a font within fixed sizes.
    The limits grow with the output size, so lower maxPixels for untrusted input.
  • Bitmap emoji (CBDT, sbix) are decoded once a render, at most 2048x2048 pixels each, and counted before they are decoded.
  • Gradients follow CSS at hard edges: the later of two stops at one position wins, also with two stops and inside the gradient.
  • Error messages show the value they got (long strings cut at 40 characters) and name the method with its class
    (Image.renderSVG(), Image.renderText(), Colors.gradient(), new Frame()).
  • Metadata: creationTime takes a Date, a number or a string (other types throw a TypeError), with a year from 1000 to 9999.
  • Binary data and dates of other realms (iframes, node:vm, Jest) are accepted; a detached buffer throws a TypeError that says so.
  • Animations: new Animation([]) can be created, the encoders throw a RangeError for an empty one.
  • Encoders check the image size before going over the pixels (JPEG, WebP, AVIF and others) with one message for all formats.
  • Gain maps: values are range-checked (±(2³¹−1), gamma ≥ 2⁻³¹); AVIF re-encoding keeps the HDR color space.
  • Fixes: resize({ fit: 'inside' }) with a box under 1 pixel throws, Image.pixels() takes its state when called,
    WebP with optimize: false gives the bytes of the streaming encoder, long text and many <tspan>s no longer overflow the
    stack or take quadratic time, and the JPEG encoder uses less memory for images with transparency.

The same arc and path limits are in 3.20.5.