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
Converting PNG to PDF (transparency issues)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting PNG to PDF (transparency issues)
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
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)
Thanks for the quick response fmw42.
We are using "pdftk" for merging the watermark, which requires another pdf document as the source of the watermark.
also tried:
and other various combination's.
The PNG image generated by GD is here.
Thanks once again.
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!fmw42 wrote:why not just overlay (or watermark) from the png? why go to pdf just to overlay it?
We are using "pdftk" for merging the watermark, which requires another pdf document as the source of the watermark.
I am using ImageMagick-6.2.8.0 on CentOS and the exact command I am using is as follows: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
Code: Select all
convert draft.png -fuzz 100% -transparent white draft.pdf
Code: Select all
convert draft.png -fuzz 100% -transparent white -background none draft.pdf
The PNG image generated by GD is here.
I'll have a read of this.fmw42 wrote:also see viewtopic.php?f=3&t=13770
Thanks once again.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Converting PNG to PDF (transparency issues)
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.
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)
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.