Page 1 of 1
Converting PNG to PDF (transparency issues)
Posted: 2009-05-13T17:53:54-07:00
by Princess_Leia
Hello all,
I'm trying to create a PDF from a transparent PNG, the PNG was created with GD and is simple text with a transparent background. We then want to convert this to PDF keeping the transparency so we can overlay another document with this "watermark".
However using the convert command, it does not appear to retain the transparency. I have tried specifying a transparent color (white) and the fuzz parameters with no luck.
Can anyone help me with this?
Regards,
Princess_Leia
Re: Converting PNG to PDF (transparency issues)
Posted: 2009-05-13T17:59:07-07:00
by fmw42
why not just overlay (or watermark) from the png? why go to pdf just to overlay it?
but to try to get to the bottom, what version of IM are you using and what exact command and can you provide a link to your images. at this point we do not have enough information to confirm your results
also see
viewtopic.php?f=3&t=13770
Re: Converting PNG to PDF (transparency issues)
Posted: 2009-05-13T18:11:07-07:00
by Princess_Leia
Thanks for the quick response fmw42.
fmw42 wrote:why not just overlay (or watermark) from the png? why go to pdf just to overlay it?
Because we are automating the process, at the time being we can manually do this without an issue using Acrobat - but as we have a large amount of documents, manually doing this every update/new document is very cumbersome!
We are using "pdftk" for merging the watermark, which requires another pdf document as the source of the watermark.
fmw42 wrote:
but to try to get to the bottom, what version of IM are you using and what exact command and can you provide a link to your images. at this point we do not have enough information to confirm your results
I am using ImageMagick-6.2.8.0 on CentOS and the exact command I am using is as follows:
Code: Select all
convert draft.png -fuzz 100% -transparent white draft.pdf
also tried:
Code: Select all
convert draft.png -fuzz 100% -transparent white -background none draft.pdf
and other various combination's.
The PNG image generated by GD is
here.
I'll have a read of this.
Thanks once again.
Re: Converting PNG to PDF (transparency issues)
Posted: 2009-05-13T18:56:25-07:00
by fmw42
I am no expert of pdf and whether IM can produce a transparent pdf. Perhaps Anthony can illuminate us both about this.
But your command
convert draft.png -fuzz 100% -transparent white draft.pdf
if it were to work would make the whole image transparent due to the -fuzz 100%.
I tried (IM 6.5.2-4 Q16 Mac OSX Tiger)
convert draft.png draft.pdf
and
convert draft.png -colorspace rgb -channel rgba -alpha on draft.pdf
but the result had no alpha channel although the text was properly masked by the alpha channel, but the background was still white and not transparent. So again I am not sure IM produced pdfs save the alpha channel.
Perhaps there is some other option for setting the background color of the pdf. Maybe Anthony knows, but I could not find it at
http://www.imagemagick.org/Usage/formats/#pdf
Also IM may rely upon Ghostscript to handle this and so may be out of IM's hands. But again I will defer to Anthony or Magick on this whole issue.
Re: Converting PNG to PDF (transparency issues)
Posted: 2009-05-13T19:01:02-07:00
by Princess_Leia
Thanks for your efforts, I too noticed it shows a white background - apparently adobe reader will still show a white background when the document is transparent - I will try updating IM and giving it a shot with the command you tried.