Page 1 of 1

Cannot succeed to convert PDF to BMP using ImageMagick

Posted: 2015-06-25T14:26:25-07:00
by OSryx
I would like to *convert* a .pdf to .bmp. The pdf I am talking about is available https://drive.google.com/file/d/0BwSN0j ... sp=sharing.

I use ImageMagick with the following command :

Code: Select all

    convert -verbose -resize 256x256 phantom-brain-ellipse.pdf phantom.bmp
but the result is a phantom.bmp file corrupted or empty file with size 0x0.

The error message is

Code: Select all

 :
    
    "/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 work fine with the same command :

Code: Select all

    convert -verbose -resize 256x256 phantom-brain-ellipse.pdf phantom.png
any idea how to fix that ?

Re: Cannot succeed to convert PDF to BMP using ImageMagick

Posted: 2015-06-25T15:44:08-07:00
by fmw42
convert -verbose -resize 256x256 phantom-brain-ellipse.pdf phantom.bmp
try putting the resize after the input image (proper IM 6 syntax) and using BMP2 or BMP3

Code: Select all

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

see

http://www.imagemagick.org/Usage/basics/#why


However, a better method (higher quality) would be to use -density (supersampling approach)

Code: Select all

convert -verbose -density 288 phantom-brain-ellipse.pdf -resize 256x256 BMP3:phantom.bmp