nfeske / genode-manual

Reference manual for the Genode OS Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warnings when generating grayscale PNGs for epub

3dik opened this issue · comments

When I try to build the epub version of the manual, 'convert' outputs the following warning message, which causes 'make' to abort:

convert-im6.q16: profile 'icc': 'RGB ': RGB color space not permitted on grayscale PNG `img/protection_domain.png' @ warning/png.c/MagickPNGWarningHandler/1665.

This happens not only with 'protection_domain.png' but with all grayscale images. The problem is probably the ghostscript command which generates the PNG image and is called with the pngalpha argument so that sRGB is used. 'convert', however, seems to output the above-mentioned warning message if its input file has a sRGB colorspace although containing only grayscale content.

Removing the ICC profile suppressed the warning message on my setup:

img/%.png: img/%-unscaled.png
    #convert -filter lanczos -resize 80% $< $@                 #before
    convert -filter lanczos -resize 80% +profile icc $< $@     #after

I can't exclude that this change just hides potential problems. That warning message might have a purpose.

My ImageMagick version on Debian/unstable:

Version: ImageMagick 6.9.10-8 Q16 x86_64 20180723 https://www.imagemagick.org

Just as a heads up. This also breaks many third party packages. An example is the mini_magick gem in ruby on rails. This error bubbles down and basically disables the ability to use greyscale png in any rails project using image scaling through mini_magick.

Furthermore, from a user and developer standpoint it seems totally strange to handle greyscale png images different than color ones... IMHO ImageMagick should handle this without any extra parameters. Sure keep the '+profile param' to do something specific but it's NOT OK to throw an error that does not happen on a RGB image with same parameters...

Remember the core use of imagemagick is to abstract these kind of things from a developer and user using ImageMagick: people use it to convert and scale images regardless of formats. Making the api different because an image is greyscale or color totally goes against the purpose of ImageMagick! If users need to diverge params between greyscale or color images they might as well use libpng directly.

@w-A-L-L-e I suspect that your intention was to reach the imagemagick project but this issue tracker is just for a project that uses imagemagick. So I'm afraid that your message will go unnoticed by the relevant people.

@3dik Thanks for reporting and proposing a solution. I'll try it out once I will update the book the next time.

Woops, yes indeed it was late at night and after figuring out the bug I wanted to write about it quickly to get my frustration over ;). Anyway then I sat back and realized I'm only really using it for a freeware project anyway so I'm just gonna leave it as is... Still, thanks for the quick reply.