Page 1 of 1

Wrong and different background converting pdf to png or tiff

Posted: 2011-03-18T05:37:13-07:00
by HeiHon
When converting "usual" pdf files to png and/or tiff convert renders different (wrong) background.

By "usual" pdf files I mean pdf files that look like black text on white paper but in fact are black text on transparent background.
But of course these pdf files are normally (by pdf readers) rendered as black text on white background.

Anyway, doing e.g.

Code: Select all

convert Acrobat_Reader_ReleaseNote_9.3.4_8.2.4.pdf Acrobat_Reader_ReleaseNote_9.3.4_8.2.4.png
you get png files with gray (not transparent) background
and doing

Code: Select all

convert Acrobat_Reader_ReleaseNote_9.3.4_8.2.4.pdf Acrobat_Reader_ReleaseNote_9.3.4_8.2.4.tiff
you get a tiff file with black background which makes it a little hard to read the text.

imagemagick 6.6.8-4 Q16 + ghostscript 9.01 + WindowsXP SP3

I found this viewtopic.php?f=3&t=18001#p68344 and yes, changing pngalpha to pnmraw helped.

But IMHO using convert without any options should render white (preferable) or transparent background and at least the fact that it renders gray background for png and black background for tiff is a bug.

Re: Wrong and different background converting pdf to png or

Posted: 2011-03-18T07:05:05-07:00
by HeiHon
Sorry, my wrong:
In fact the png files produced by "convert file.pdf file.png" ARE transparent.
My image viewer needed a restart to show the transpareny :-(

Please excuse me.

So at least for my needs I will have pnmraw instead of pngalpha in my delegates.xml.

Re: Wrong and different background converting pdf to png or

Posted: 2011-03-18T07:14:34-07:00
by magick
You can use the pngalpha device and add +matte to your command line. The +matte turns off transparency.

Re: Wrong and different background converting pdf to png or

Posted: 2011-03-21T08:14:10-07:00
by HeiHon
Thanks for the reply.

I normally use ImageMagick via the perl Image::Magick module.

As I wrote in my other post
viewtopic.php?f=7&t=18285
there seems to be another way from the command line.
However, one of my problems is, that there doesn't seem to be an easy way to translate the command line args to properties to be set with the perl $image object.

But thanks, I will try matte settings.