You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
GD is not designed to repair image. The issue lies with the image file itself, not the code reading it. The most appropriate solution is to fix the problematic PNG files at the source or before they are processed by this adapter. As noted in the description, this can be done using external tools like mogrify -strip (from ImageMagick) or pngcrush to remove or correct the invalid profile.
While we can suppress the warning by using the @ operator, this only hides the symptom; it doesn't fix the underlying problem with the image file.
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
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
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?
The text was updated successfully, but these errors were encountered: