How to solve the errors: ibpng warning iccp known incorrect srgb profile, wrong file, the file does not exist in Magento 2

“ibpng warning iccp known incorrect srgb profile” is a common error message that users will probably face when working with Magento 2. In this tutorial, Magesolution will be digging into these errors and learning how to fix them properly.

ibpng warning iccp known incorrect srgb profile

Magento 2 provides a very useful command to resize images on storefronts to save disk space as well as boost the load speed of your Magento site faster.

php bin/magento catalog:images:resize

Sometimes, the error message ” ibpng warning iccp known incorrect srgb profile” showcase when you resize product images on your Magento 2 storefront as below picture:

ibpng warning iccp known incorrect srgb profile

Cause of the error” ibpng warning iccp known incorrect srgb profile”

When you check the image’s ICC profiles, Magento 2 did not find an iCCP chunk in the PNG image profile, thus the system automatically shows this error message and stops the image resize process. If you see the above error warning while loading a PNG image, it means the iCCP chunk is present in the image. This is not essentially an issue so you can ignore it. But if you want to fix it, you have to remove the iCCP chunk.

Also read:

How to fix this error ” ibpng warning iccp known incorrect srgb profile”

Solution 1

You will need to use the Linux command to remove the iCCP chunk from the images. At first, you connect to your server using SSH as the root user and follow the below command to remove the iCCP chunk from PNG Images on your Magento 2 website. If your image files located in pub/media

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

After that, you need to re-run the image resize command and the issue is solved, 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 ignore this error and continue the process by editing the vendor/magento/module-media-storage/Service/ImageResize.php file and putting the following code in line 186

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

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

Solution 2

If you are using an app that treats warnings as errors you do have to remove the chunk. You can perform this task any of a variety of PNG editors such as ImageMagick’s.

convert in.png out.png

Also, you can remove the invalid iCCP chunk from all of the PNG files in a folder (directory), you can utilize mogrify from ImageMagick:

mogrify *.png

This requires that your ImageMagick was built with libpng16. If you want to check it, follow the below command.

convert -list format | grep PNG

If you’d like to find out which files need to be solved instead of blindly processing all of them, you can use the following command

pngcrush -n -q *.png

where the -n means don’t rewrite the files and -q means suppress most of the output except for error. Sorry, there’s no option yet in pngcrush to suppress everything but the warnings.

Conclusion

That’s all about the ” ibpng warning iccp known incorrect srgb profile” error and how to fix it. If you face any issues while fixing this error, then feel free to contact our support team for a quick fix. We are one of the leading Magento service providers. Also, we are one of the best Magento web development services providers in the world. With experienced Magento developers, we commit to providing high-quality products and services to help customers achieve their business success.