Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jpeg cropping edge case #127

Merged
merged 2 commits into from
May 6, 2021
Merged

Fix jpeg cropping edge case #127

merged 2 commits into from
May 6, 2021

Conversation

bitzl
Copy link
Member

@bitzl bitzl commented Apr 29, 2021

TurboJpeg expects cropping regions to be multiples of the MCU size. In some cases it was possible that the cropping region was larger than the image due to rounding artifacts (less than one MCU). This MR checks if the resulting region would exceed the image and makes it one MCU width and/or height smaller if needed.

TODO: Is it necessary to adjust the extraCropping to make sure it will be inside the adjusted region?

TurboJpeg expects cropping regions to be multiples of the MCU size. In
some cases it was possible that the cropping region was larger than the
image due to rounding artifacts (less than one MCU). This MR checks if
the resulting region would exceed the image and makes it one MCU width
and/or height smaller if needed.
@jbaiter jbaiter marked this pull request as ready for review May 6, 2021 11:20
@jbaiter jbaiter merged commit 97ac087 into main May 6, 2021
@jbaiter jbaiter deleted the fix-region-adjustment branch May 6, 2021 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants