-
Notifications
You must be signed in to change notification settings - Fork 27
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
API/resize: fix failure on greyscale images #97
Conversation
Bump Pillow to >=7.0 - now uses bicubic resize on colour images. Remove code that forced this on all images as this caused greyscale images to fail resizing.
…ame in restful.py. pin Werkzeug <3.0.
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.
Let's add a minor version bump since this does update some dependencies + deprecates some settings.
Thanks!
if resample: | ||
arguments["resample"] = resample |
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.
This is not needed given the line above, right? arguments
will already have a "resample"
key set to the value passed as argument to the resize
function now that the resample
assignment from the setting has been removed.
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.
Oops, meant to take it out from the line above - I don't wnt to pass "resample=None" to resize.
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.
Ah I see so something like:
if resample: | |
arguments["resample"] = resample | |
if resample is None: | |
del arguments["resample"] |
to remove resample completely.
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.
or better yet:
arguments = {...} # without resample
if resample is not None:
arguments["resample"] = resample
I can't merge on this repo. Maybe someone else with merging powers? |
❤️ Thank you for your contribution!
Description
As reported by @fenekku - resize operations were failing on greyscale images. This was caused by the method specified in IIIIF_RESIZE_RESAMPLE being applied to all image regardles of mode.
This setting appears to have been added to force Pillow to perform (higher quality) bicubic resampling on colour images.
Since Pillow 7.0, bicubic is used by default on colour images - thus we can simply bump the Pillow version requirement and remove the override / allow Pillow to select the most appropriate method.
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Third-party code
If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: