Repository navigation
v3.2.1: faster resizing, blur and GIF decoding
This release makes resizing, blurring and GIF decoding faster, and fixes a bug when enlarging with RESIZE_AREA. Nothing changes in the API.
Performance
| 1920×1080 photo | 3.2.0 | 3.2.1 |
|---|---|---|
resize() to half (bilinear) |
49 ms | 15 ms |
resize() to half (area) |
33 ms | 9 ms |
resize() to double (bilinear) |
392 ms | 89 ms |
blur(5) |
205 ms | 86 ms |
| decoding a 101-frame GIF | 134 ms | 83 ms |
Resizing (#68)
- The arithmetic is integer and the vertical pass runs first.
- For opaque images, two color channels share one multiplication.
- Bicubic resizing and images with alpha get 20–40% faster.
Blur (#69)
The three box blurs work directly on the pixels as 32-bit words, two channels per sum. Transparent images are blurred premultiplied in 8 bits, as browsers do.
Smaller speedups
- GIF decoding (#70): frames are composited from their color indices instead of an RGBA copy of each, and they're no longer copied a second time. The output is bit-identical.
clone(): about 50% faster.
Fixes
- Enlarging with
RESIZE_AREAleft transparent rows and columns where a pixel's center fell exactly on the edge of the filter (#68).
Upgrading
No code changes are needed. If you compare resized or blurred images against stored reference images pixel by pixel, expect small differences:
- most values differ by at most 1 per channel (blur: 2 for radii above 10)
- larger differences are limited to the color of pixels that are almost fully transparent, which doesn't show once they're composited