Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When uploading certain PNG images (specifically those with a non-standard or incorrect color profile), the following PHP warning is triggered:
Warning: imagecreatefrompng(): gd-png: libpng warning: iCCP: known incorrect sRGB profile in /app/lib/Varien/Image/Adapter/Gd2.php on line 64
This happens when uploading images through the admin panel or regular file upload processes.
If I instead import the image via PHP, the upload appears to succeed, but on the frontend, the image is not displayed. Instead, the placeholder image is shown.
Expected Behavior
Expected Behavior
Images with embedded color profiles (even if incorrect) should be handled gracefully.
No PHP warning should be thrown, and images should appear correctly on the frontend after upload or import.
Steps To Reproduce
Prepare a PNG file that includes an embedded iCCP color profile (commonly found in images exported from certain graphic tools). Or download the attached one here.
Go to the admin panel and attempt to upload the image through the media uploader.
Observe the warning in logs or output:
Environment
- OpenMage: 20.9.0
- php: 7.4
Anything else?
Sample image is attached which triggers the issue.
Temp. solution: mogrify -format png -strip file.png
Maybe it is possible to clean a image in PHP like mogrify does, before upload?