Problems converting PDF to BMP using ImageMagick?

I would like a convertPDF for BMP. The pdf I'm talking about is available here .

I am using ImageMagick with the following command:

convert -verbose -resize 256x256 phantom-brain-ellipse.pdf phantom.bmp

But the result is a damaged or empty file phantom.bmpwith pixel sizes 0x0.

Error message:

"/opt/local/bin/gsx" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=/var/tmp/magick-1199-UNts2yPB9u2%d" "-f/var/tmp/magick-1199rG26g03biUuT" "-f/var/tmp/magick-1199-sNgqMmlD53M"
/var/tmp/magick-1199-UNts2yPB9u21 PNG 263x263 263x263+0+0 8-bit sRGB 54.6KB 0.010u 0:00.009
phantom-brain-ellipse.pdf PDF 263x263 263x263+0+0 16-bit sRGB 54.6KB 0.000u 0:00.000
phantom-brain-ellipse.pdf=>phantom.bmp PDF 263x263=>256x256 256x256+0+0 16-bit sRGB 262KB 0.020u 0:00.019

When I convert to PNG, everything works fine with the same command:

convert -verbose -resize 256x256 phantom-brain-ellipse.pdf phantom.png

Any idea how to fix this?

Partial solution

This command allowed me to get the correct BMP:

convert phantom.png BMP3:phantom.bmp

But I do not understand why this works!

+4
source share
1 answer

Try:

convert -verbose -resize 256x256 phantom-brain-ellipse.pdf[0] BMP3:phantom.bmp

Update / Explanation

  • PDF is a multi-page format. Potentially, the input PDF file has more than one page.

    ImageMagick filename[i], i - . , some.pdf[0] : " 1 PDF."

  • SOMEFORMAT:filename , . , GIF:some.png GIF () .png.

  • BMP3: - BMP. BMP:filename filename.bmp 4 BMP. 3 BMP3:filename.bmp. 2 BMP2:filename.bmp.

  • BMP3:, , ...

+2

All Articles