Problem converting pdf to gif

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
vespito

Problem converting pdf to gif

Post by vespito »

Hi,
when I convert pdfs having white backgrounds I have no problem (working examples):

convert -resize 32x42 -colors 256 "http://www.aspb.cat/quefem/docs/grip_2_6_09.pdf[0]" public_html/qua.gif


but with coloured backgrounds I get strange double size gifs:

convert -resize 32x42 -colors 256 "http://www.aspb.cat/quefem/docs/Indicad ... fico.pdf[0]" public_html/qui.gif

Where is my error? Thank you in advance for any hint. Regards;

Carlo.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem converting pdf to gif

Post by anthony »

First order your options so the operations are performed AFTER reading the image (which is itself an operation.

So try

Code: Select all

convert "http://www.aspb.cat/quefem/docs/Indicadores_morbilidad_accidentes_trafico.pdf[0]" -resize 32x42 -colors 256 public_html/qui.gif
and report if this clears you problem.

It may be that as you are relying on the 'legacy' option handling, the -colors may be
applied BEFORE the -resize operator.

See beginning section of IM Examples Basics
http://www.imagemagick.org/Usage/basics/

Or more specifically
http://www.imagemagick.org/Usage/basics/#legacy

Actually the -colors 256 is probably redundant here, as GIF format, by definition' can not handle more than 256 colors, so IM will automatically do the color reduction for that format.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
vespito

Re: Problem converting pdf to gif

Post by vespito »

Moving the options after the image does not solve the problem, sorry.
The -colors 256 is redundant and taking it out does not solve the problem either.
The problem persists also converting to png or to jpg and using -thumbnail or -scale instead of -resize: I always get an image that is half white on the left and half the image itself as it should be, but narrowed, on the right.
I'm surely doing something stupid, but I can't see what. Could you help me?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem converting pdf to gif

Post by magick »

We tried your command with the latest release of ImageMagick, 6.5.3-7, and it worked as expected. We get a half white and half goldish. Perhaps there is a bug in your release of ImageMagick or Ghostscript (we're using GS 8.64).
vespito

Re: Problem converting pdf to gif

Post by vespito »

It should be all goldish! The white part is mistaken, since the first page of the pdf is all goldish.
Post Reply