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 52fa11f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: guides/Migrating to 4.0.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -226,11 +226,13 @@ Several values that 3.x quietly changed into something else now throw, naming th
226
226
| `frame.xOffset`, `frame.yOffset` (and encoder `add()` offsets) | stored as given, fractions included (`0.4`) | truncated to integers when set, like image sizes, so the offset you read is the one that is encoded |
227
227
| `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 |
228
228
| A number given as a string (`'0.5'`), `null` or a boolean where a number goes (`opacity('0.5')`, `quality: '50'`, `frame.duration = '40'`, `maxPixels: '100'`, `Colors.gradient()`'s positions) | converted by some methods (`'0.5'` was `0.5`, `null` was `0`), rejected by others | a `TypeError` naming the value, by all of them |
229
+
| A string where a boolean goes (`optimize: 'yes'`, `applyOrientation: 'no'`, `sharpYuv`, `hinting`, ...) | read as `true` (also `'no'` and `'false'`) | a `TypeError`: `true` or `false` only |
229
230
| `roundCorners({ radius })` below 0 | clamped to 0 | a `RangeError` |
230
231
| `fisheye({ strength })` of 0 or less | an empty image | a `RangeError` |
231
232
| `Colors.gradient()` at a `NaN` position | transparent black with two stops, a `RangeError` with more | a `RangeError` with any number of stops |
232
233
| `encodeGIF()` of an animation without frames | a GIF that doesn't decode | an `Error`, like `encodeAPNG()` and `encodeWebP()` |
233
234
| `quality` of `encodeJPEG()` | clamped to 1-100 | a number from 0 to 100 (0 is 1), else a `RangeError`, like the other lossy formats |
235
+
| JPEG and lossy WebP data that is cut off (a scan that ends before its last block, a WebP chunk shorter than its size) | decoded without an error, as a gray or smeared image | an `Error`, like the other formats. A JPEG that only lacks its end marker still decodes |
234
236
| 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 |
235
237
236
238
A value outside a fixed set of choices is a `TypeError` naming them all, like `resize mode must be 'nearest-neighbor',
@@ -658,4 +660,4 @@ search can't tell an animation from an array, so check the type of each receiver
658
660
Then compile with `tsc`, and run the tests that cover your decode and encode paths. The seventeen behavior changes need
659
661
runtime checks: a file with several frames, a one-frame GIF, any `loopCount: -1`, every resize fit mode, every HSL hue,
660
662
every `rotate()`, every `dominantColor()` threshold, all text rendered with a size, every JPEG made from an image with transparency, every `quantize()`, the size changes of frames, the
661
-
values that now throw, gradients with transparent stops, gain maps given to images, anything that reads the metadata of encoded files, and every SVG with images.
663
+
values that now throw (cut-off uploads among them), gradients with transparent stops, gain maps given to images, anything that reads the metadata of encoded files, and every SVG with images.
0 commit comments