PNG -> PDF requires workaround

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
mde

PNG -> PDF requires workaround

Post by mde »

I'm trying to convert a PNG to PDF. The generated PDF's colors look bad (saturated?) -- really dark. I've messed with various quality/color/saturation settings, but to no effect. I don't really know what I'm doing (wrong), but this behavior looks wrong.

Code: Select all

$ convert foo.png foo.pdf
$ acroread foo.pdf  # ugly dark image
Workaround:

Code: Select all

$ convert -quality 100 foo.png foo.jpg
$ convert -quality 100 foo.jpg foo.pdf
$ acroread foo.pdf  # nice
Any tips appreciated!

BTW, I also found this old post that appears to be the same issue:
http://newsgroups.derkeiler.com/Archive ... 00256.html
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG -> PDF requires workaround

Post by fmw42 »

try

convert foo.png -density 300 foo.pdf
mde

Re: PNG -> PDF requires workaround

Post by mde »

Thanks. That does not affect the dark color though. I'm addressing my density misunderstanding in another thread (viewtopic.php?f=1&t=15622&p=55493), but I believe this color issue is unrelated to density.

So still a problem.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG -> PDF requires workaround

Post by fmw42 »

post a link to your image so others can test or see if some other issue
mde

Re: PNG -> PDF requires workaround

Post by mde »

I've isolated the problem.

My whole conversion flow starts with a GIMP XCF.

1. pull JPG image into GIMP as a layer (layer is smaller than canvas)
2. "save as" foo.png
3. convert foo.png foo.pdf
4. look at dark ugly image

The problem only occurs if my GIMP canvas size does not match the original JPG's layer size. If the layer size matches, the convert goes well.

I can work around this problem by having GIMP do a "Layer to Image Size" for the JPG layer. So I suppose the advice I'll heed is to make sure image layers are always matched to image size.

I don't know if this is a GIMP or ImageMagick problem, but I'm not too worried about it at this point, as I have some workarounds/best practices to address it.
Post Reply