PDF to PNG conversation problems

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
pasigydziau
Posts: 1
Joined: 2011-02-03T02:31:35-07:00
Authentication code: 8675308

PDF to PNG conversation problems

Post by pasigydziau »

Hello. I am trying to convert pdf to png. And i found this problems:
1. I don't need transparency. Document should stay white. If i turn -alpha off, i get corrupted document.
2. Border. If i set 1x1 border, for some unknown reasons all my document turn into big blue border.

Examples below:

Code: Select all

C:\imagemagick>convert.exe -resize "300x300>" -density 300 test.pdf test.png
Image

Code: Select all

C:\imagemagick>convert.exe -resize "300x300>" -density 300 -background white -bo
rdercolor blue -border 1x1 test.pdf test.png
Image

Code: Select all

C:\imagemagick>identify.exe -verbose test.pdf
Image: test.pdf
  Format: PDF (Portable Document Format)
  Class: DirectClass
  Geometry: 420x595+0+0
  Resolution: 72x72
  Print size: 5.83333x8.26389
  Units: Undefined
  Type: GrayscaleMatte
  Base type: GrayscaleMatte
  Endianess: Undefined
  Colorspace: RGB
  Depth: 16/8-bit
  Channel depth:
    gray: 8-bit
    alpha: 8-bit
  Channel statistics:
    Gray:
      min: 0 (0)
      max: 65535 (1)
      mean: 58999.1 (0.900269)
      standard deviation: 19637 (0.299641)
      kurtosis: 5.13769
      skewness: -2.67164
    Alpha:
      min: 0 (0)
      max: 65535 (1)
      mean: 4129.64 (0.0630143)
      standard deviation: 13685.6 (0.208829)
      kurtosis: 10.1864
      skewness: -3.36441
  Alpha: rgba(255,255,255,0)   #FFFFFFFFFFFF0000
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgba(223,223,223,1)
  Matte color: grey74
  Transparent color: none
  Compose: Over
  Page geometry: 420x595+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Properties:
    date:create: 2011-02-03T11:53:00+02:00
    date:modify: 2011-02-03T11:53:02+02:00
    pdf:HiResBoundingBox: 420x595+0+0
    pdf:Version: PDF-1.4
    signature: e2044663febe176b6e80a2b17cdf2bfdc928ddcfe50c716b872e31ee43b719
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 54.1KBB
  Number pixels: 250KB
  Pixels per second: 15.62MB
  User time: 0.016u
  Elapsed time: 0:01.016
  Version: ImageMagick 6.6.7-4 2011-01-29 Q16 http://www.imagemagick.org
Original pdf:
http://ma-fi.lt/test.pdf
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to PNG conversation problems

Post by fmw42 »

this seems to work for me on IM 6.6.7.4 Q16 Mac OSX tiger

convert -density 300 test.pdf -alpha off -resize 300x300 PNG24:test.png

as does this

convert -density 300 test.pdf -alpha off -resize 300x300 -bordercolor blue -border 1 PNG24:test2.png

see

http://www.imagemagick.org/Usage/basics/#cmdline
http://www.imagemagick.org/Usage/formats/#png_formats
Post Reply