Fixing magento issues

[SOLVE] Magento 2 libpng warning: iCCP: known incorrect sRGB profile, Wrong file, file does not exist

Pinterest LinkedIn Tumblr

Magento 2 provide a very helpful command to resize images on storefronts to save disk space as well as make load speed of your website faster.

php bin/magento catalog:images:resize

Some times, the error message libpng warning: iCCP: known incorrect sRGB profile appears when you resize product images on your Magento 2 storefront as below

libpng warning iCCP known incorrect sRGB profile

Throughout this tutorial, you will learn what caused this error and how to fix it

Cause of the error

When checking images ICC profiles, Magento 2 did not find iCCP chunk in PNG image profile, thus the system automatically throws this error message and stop the image resize process

(You can learn more about iCCP chunk here:


To fix this issue, we will use Linux command to remove iCCP chunk from the images.

Connect to your server using SSH as root user and use the following syntax to remove iCCP chunk from PNG Images on your website.

If your images files located in pub/media

find pub/media -type f -iname '*.png' -exec pngcrush -ow -rem allb -reduce {} \;

Next, re-run image resize command and the issue is fixed, you now can resize images normally

If you see the error: Wrong file => that means the files you want to resize do not exist in the folder. Recheck the image files in that folder or you can force Magento 2 to ingore this error and continue the process by editing vendor/magento/module-media-storage/Service/ImageResize.php file and put the following code in line 186

if ($this->mediaDirectory->isFile($originalImagePath) && filesize({path_to_the_file}))

Now all the error should go away and you can process image resize normally

Hung Tran is the main editor of, he loves to write about everything related to Magento 2

1 Comment

Write A Comment