Magento – How to remove interlacing from the PNG files in magento 2

magento2.2sitemaps

I have added a third-party extension for XML sitemap. When I generate a sitemap, I am getting "Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.". That extension company said,
sitemap generation error is related to your server:

"libpng warning: Interlace handling should be turned on when using
png_read_image"

I googled it found this solution for removing interlacing from the PNG files is using ImageMagick's 'convert' utility:

$ convert in.png -interlace none out.png

but I don't know how to apply it in Magento 2 for all images.
any help would be appreciated

Best Answer

If you mean you want to run this convert command on several png files, you could try:

find . -iname *.png -execdir convert {} -interlace none {} \;

This would be equivalent to running for every .png file:

convert <mypngfilename> -interlace none <mypngfilename>

where <mypngfilename> is, obviously, the name of the png file.

Make sure you try find . -iname *.png first alone to see the results being produced and making sure they are what you need. Also I am also not familiar with the convert command so test it first on one file to make sure that having the <out> file and <in> file being the same name does not cause issues.

That said, I'm quite suspicious that your sitemap would have anything to do with that warning in the first place but I couldn't tell you with 100% certainity.

Related Topic