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.
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
De-zigzag JPEG's DQT when loading; deprecate convert_dict_qtables #4989
De-zigzag JPEG's DQT when loading; deprecate convert_dict_qtables #4989
Changes from 2 commits
9980981
4dc1953
a1d8d63
70c7514
d11c794
afb6ad2
dfeb49c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A thought (feel free to disagree) - if we're considering this to be a public method that requires deprecation, then should we maybe just leave the functionality there (still adding in the deprecation warning)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I searched GitHub for this function: https://github.com/search?q=convert_dict_qtables+language%3Apython+-filename%3AJpegPresets.py. There are not many uses. Only the first two pages contain interesting results. The rest is just copies of Pillow itself. They all take the
.quantization
of an existing image, convert it to a nested list with this function and then manipulate that nested list in some way.If Pillow de-zigzags the tables when loading (as the rest of this PR does),
.quantization
no longer needs any conversion step. That means those existing uses of theconvert_dict_qtables
function will actually break their code. The order of the numbers in the tables will be wrong. They'd need to remove the function call to fix their code. Turningconvert_dict_qtables
into a no-op means their code will continue to work unchanged. They'll only need to remove the function call to get rid of the warning.Most people don't need to mess with quantization tables. But there's obviously more code than just what I found on GitHub and I don't know how representative these uses are. I guess there could also be cases where people are getting qtables from somewhere other than straight from an image's
.quantization
. Maybe they serialized them for later re-use? In that case they no longer have a helper function that converts them back.I guess Pillow could temporarily add a new
really_convert_dict_qtables
for those who still need it. 😉There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@radarhere What do you think? Shall we merge this PR as is?
(And can explicitly replace "a future version" with "Pillow 10 (2023-01-02)")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure - I can see now why
convert_dict_qtables
should do nothing, so no objections from me.