Fix VP8X WebP dimension parsing bug #67
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug in VP8X WebP dimension parsing where reported dimensions were 1 pixel smaller than actual size in both width and height.
Problem
VP8X format stores canvas dimensions as
(width-1, height-1)in the header, but the parser was returning these raw values without adding 1, causing incorrect dimensions to be reported.Example:
(199, 0)(200, 1)✓Changes
+1to both width and height when parsing VP8X headers inimagesize.pytest_load_webp_vp8x()with VP8X test image (200×1)Test plan
test_vp8x.webp(200×1 image)+1)Technical Details
The VP8X chunk format stores canvas width and height as 24-bit little-endian values representing
(actual_width - 1)and(actual_height - 1)according to the WebP specification. The VP8L parser already correctly adds 1, but VP8X was missing this adjustment.This fix ensures consistency across WebP format parsers and compliance with the WebP specification.