imagemagickpng

Setting number of channels in imagemagick convert


I have used imagemagick to convert a PDF into a PNG. Problem is that if the PDF is black and white, my images are saving as single channel instead of three channel. This is causing me issues down the line, and would be best to fix here.

Does anyone know how I can force my black and white images to have three channels, ideally using convert?

convert -density 128 FNAME-12A.pdf -quality 100 -channel RGB FNAME-12A.png

Solution

  • Prefix the output filename with PNG24:

    convert something ... PNG24:output.png
    

    For the sake of completeness and future reference, you can also use the following to force PNG variants: