You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6250dcc
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ Upgrading from 3.x? Upgrade to the latest 3.x release first, fix the deprecation
88
88
89
89
-**An animation has its own canvas size**: decoded animations keep the file's, `new Animation(frames, { width, height })` sets one (`AnimationCanvasOptions`), and `resize()` sets the new one. Without one it is the frames' extent, as before. Frames (or their parts) outside the canvas aren't encoded.
90
90
91
-
-**Values that were wrapped, clamped or ignored throw**: colors have to be integers from -2^31 to 2^32 - 1, also the ones a `fill()` function returns (they wrapped to 32 bits; negative ones, which bitwise operators return, keep working); pixel coordinates are truncated without wrapping at 2^32; `compression` is an integer 0-9 like `effort` (it was clamped); frame durations that GIF, APNG or WebP can't store throw a `RangeError` like loop counts (they were cut; unchanged frames merged by the encoders are split at the limit); `frame.xOffset` and `frame.yOffset` are truncated to integers when set; `image.bitmap = view` throws a `TypeError` for a view that doesn't start at a multiple of 4 bytes (it was copied, so changes to the view were lost); `Colors.gradient()` throws for a `NaN` position with any number of stops; `encodeGIF()` of an animation without frames throws like the other encoders.
91
+
- **Values that were wrapped, clamped or ignored throw**: colors have to be integers from -2^31 to 2^32 - 1, also the ones a `fill()` function returns (they wrapped to 32 bits; negative ones, which bitwise operators return, keep working); pixel coordinates are truncated without wrapping at 2^32; `compression` is an integer 0-9 like `effort` (it was clamped); frame durations that GIF, APNG or WebP can't store throw a `RangeError` like loop counts (they were cut; unchanged frames merged by the encoders are split at the limit); `frame.xOffset` and `frame.yOffset` are truncated to integers when set; `image.bitmap = view` throws a `TypeError` for a view that doesn't start at a multiple of 4 bytes (it was copied, so changes to the view were lost); `Colors.gradient()` throws for a `NaN` position with any number of stops; `encodeGIF()` of an animation without frames throws like the other encoders; the `quality` of `encodeJPEG()` is checked like the other formats' (0-100, it was clamped); `composite()` throws a `TypeError` for a source that isn't an `Image`.
92
92
93
93
-**Invalid choices throw a `TypeError` naming the valid ones**: the resize `mode` (an `Error`, thrown once resizing started, so `resize({ fit: 'cover' })` could move a frame's offsets before failing), `composite()`'s `mode`, `flip()`, `disposalMode` and `wrapStyle` (`RangeError`s; an empty or `null``wrapStyle` was the default).
94
94
@@ -100,6 +100,9 @@ Upgrading from 3.x? Upgrade to the latest 3.x release first, fix the deprecation
100
100
101
101
### New
102
102
103
+
-`GainMap.decode(data, { maxPixels })` takes the limit of `Image.decode()`, and the `LimitError` that these limits throw is exported (with `name``'LimitError'`).
104
+
-`rotate(angle, { expand: false })` keeps the image's size for quarter turns, too: the turned image is centered and what doesn't fit is cut off (they swapped width and height).
105
+
-`renderSVG()` throws for masks, clip paths, patterns, markers and filter images nested in each other so deeply that they would multiply (three per level took minutes at ten levels), and stops at 24 `feTurbulence` octaves, which are all that its output can hold. Shapes far outside the image no longer make rendering hang.
103
106
-`renderSVG({ maxLayerPixels })` limits the layers SVG rendering uses at once (groups with opacity, masks, filters, ...; 16 bytes per pixel each), so nested ones can't multiply the memory of a small SVG: default `4 * maxPixels`. `renderSVG({ maxImagePixels })` limits the raster images an SVG references together (default `maxPixels`; each was limited on its own before).
104
107
-`renderText({ maxPixels })`, default 16383², counting the outline, checked before anything is allocated.
Copy file name to clipboardExpand all lines: guides/Migrating to 4.0.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,6 +221,8 @@ Several values that 3.x quietly changed into something else now throw, naming th
221
221
|`image.bitmap = view` with a view that doesn't start at a multiple of 4 bytes | copied, so changes to the view no longer reached the image | a `TypeError`: pass an aligned view, or `view.slice()` for a copy |
222
222
|`Colors.gradient()` at a `NaN` position | transparent black with two stops, a `RangeError` with more | a `RangeError` with any number of stops |
223
223
|`encodeGIF()` of an animation without frames | a GIF that doesn't decode | an `Error`, like `encodeAPNG()` and `encodeWebP()`|
224
+
|`quality` of `encodeJPEG()`| clamped to 1-100 | a number from 0 to 100 (0 is 1), else a `RangeError`, like the other lossy formats |
225
+
| The source of `composite()` when it isn't an `Image`| a `TypeError` from inside (`Cannot read properties of undefined`) or nothing | a `TypeError` naming the call |
224
226
225
227
A value outside a fixed set of choices is a `TypeError` naming them all, like `resize mode must be 'nearest-neighbor',
226
228
'bilinear', 'bicubic' or 'area', not 'lanczos'`. This changes the error type of the resize `mode` (an `Error`, and only
0 commit comments