15

I use Imagemagick convert to convert pdf file to png as follows:

Magick convert -density 300 PointOnLine.pdf -quality 90 PointOnLine.png

It gives warning:

convert: profile 'icc': 'RGB ': RGB color space not permitted on grayscale PNG `PointOnLine.png' @ warning/png.c/MagickPNGWarningHandler/1744.

And png image created is all black. However, convert to jpg image is fine. What is the problem? Thanks.

18

Try adding -colorspace RGB before the outfile name.

convert -density 300 PointOnLine.pdf -quality 90 -colorspace RGB PointOnLine.png
2
  • Nice. For me the white background became transparent, but this can still be used. – user74094 Mar 25 '20 at 14:46
  • Note that this solution, although removing the warning, also changes the shades of gray in the generated PNG. – DannyB Dec 22 '20 at 9:52
9

The documentation says this:

PNG RW Portable Network Graphics Requires libpng-1.0.11 or later, libpng-1.2.5 or later recommended. The PNG specification does not support pixels-per-inch units, only pixels-per-centimeter. To avoid reading a particular associated image profile, use -define profile:skip=name (e.g. profile:skip=ICC).

So try adding -define profile:skip=ICC (or skip="*") before the outfile name.

See also: documentation on the define command

3
  • 1
    No, after setting -define profile:skip=ICC, image is still dark. But if convert to jpg and then to png, it is ok, but background is dark. The same warning happens. – hermes Feb 7 '18 at 18:19
  • This works better than setting -colorspace RGB - for me it removes the warning and does not alter the shades of gray of the output. – DannyB Dec 22 '20 at 9:53
  • I don’t want to put the validity of this answer in question but I just don’t understand the connection between “pixels per centimetre/inch” and a colour profile. Can somebody explain this to me? – Torsten Bronger Jul 22 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.