Cannot succeed to convert PDF to BMP using ImageMagick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
OSryx
Posts: 1
Joined: 2015-06-25T14:20:40-07:00
Authentication code: 6789

Cannot succeed to convert PDF to BMP using ImageMagick

Post 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 ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cannot succeed to convert PDF to BMP using ImageMagick

Post 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
Post Reply