-
Notifications
You must be signed in to change notification settings - Fork 53
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 color management by keeping ICC color profiles and EXIF data in addition #136
Conversation
…from the original image. Add first tests for these methods using a photo of a color checker with two different ICC profiles. Image source of the sRGB version: https://en.wikipedia.org/wiki/ColorChecker#/media/File:Gretag-Macbeth_ColorChecker.jpg
…data(). Add sanity check to save_as_jpeg() method for testing purposes
…data(). Add sanity check to save_as_jpeg() method for testing purposes
…data(). Add sanity check to save_as_jpeg() method for testing purposes
… not supoort color profiles
…ponding PIL.ImageOps operation
…from save_as_webp due to a lack of support
@andre-fuchs thank you very much for this. We use pre-commit with black/ruff, and is one of the testing dependencies - https://github.com/wagtail/Willow/blob/main/pyproject.toml#L44 Can you run |
Thanks @zerolab. Just did learn about pre-commit and reformatted the code. Here is a quick summary of this update:I added two methods to the class This was strongly inspired by #63, which also modified the Note: This workaround is not necessary anymore. |
Thank you @andre-fuchs. Will aim to review and test ASAP |
The changes to Two birds with one stone! |
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.
LGTM!
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.
@andre-fuchs sorry for the delay. Lots of fantastic work here! Added a few notes on improving the API a bit.
Do let me know if you have the capacity to address these
…to the save methods of the WandImage class as well. ICC color profiles do work with JPEG and WebP. EXIF data does work with JPEG only. Add unit tests.
…ddition (#136) * Add ICC profile and EXIF data methods to the PillowImage class Includes tests for these methods using a photo of a color checker with two different ICC profiles. Image source of the sRGB version: https://en.wikipedia.org/wiki/ColorChecker#/media/File:Gretag-Macbeth_ColorChecker.jpg * Modify the implementation of auto_orient() so that it uses the corresponding PIL.ImageOps operation * Add tests for save_as_ and auto_orient methods. * Add ICC profile and EXIF data methods to WandImage class as well. ICC color profiles do work with JPEG and WebP. EXIF data does work with JPEG only. Add unit tests. * Preserve EXIF data in PillowImage.save_as_png and WandImage.save_as_png Co-Authored-By: Ștefan Istrate <[email protected]>
Thanks @zerolab for tidying up! |
Thank you for helping us take this over the finish line, @andre-fuchs! |
Cannot wait to use it. Many of my clients were complaining about the color conversion in Wagtail. This should solve it. Upgrading Wagtail via PIP doesn’t do the trick yet: |
@andre-fuchs You can install version 1.6.3 instead: https://github.com/wagtail/Willow/releases/tag/v1.6.3. Wagtail's upper version boundary on Willow likely won't be updated until Wagtail 6.0 unless wagtail/wagtail#11272 is backported to the |
Adds methods to keep the ICC color profile and EXIF data if supported for JPEG, PNG, WebP and AVIF file formats. Extends the unit tests accordingly. All tests passed.
Closes #114
Closes #137