PNG Transparency
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
When converting from PDF or PS formats IM uses Ghostscript. Unfortunatally it needs help when you want to preserve transparency from such file formats...
See the recent forum note for postscript...
Converting EPS to transparent GIF part 3
http://redux.imagemagick.org/discussion ... php?t=7366
For full details and solutions.
See the recent forum note for postscript...
Converting EPS to transparent GIF part 3
http://redux.imagemagick.org/discussion ... php?t=7366
For full details and solutions.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Looking in the delgates.xml file, It looks like PDF is converted to PS then PS is converted to images.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
While I have not had the 'pleasure' (sic) of modifing delegate code, though I plan to for the documenting of IM examples, that does NOT look right to me.
The previous code generated 'eps' which is what the delegate declares will be returned.
The new one returns a transparent alpha, but still declares it generated 'eps'.
I suggest you check it and update.
The previous code generated 'eps' which is what the delegate declares will be returned.
The new one returns a transparent alpha, but still declares it generated 'eps'.
I suggest you check it and update.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
With "type.xml" in your home ".magick" sub-directoyr you can append your own fonts to the system font list, I would like to know if you can do the same, or even override the system version using a "delegate.xml" in that same home sub-directory.
Christy can you help shead light on this?
Christy can you help shead light on this?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Thanks Chrisy.
How does IM determine if a delegate is unique, and how does it pick between
say a "pdf -> png" and the system "pdf -> eps" delegates?
Eg will adding a "pdf -> png" delegate cause it to be used as it is more direct?
Can you specify 'alturnate' input/output format delegates?
For example can we specify a delegate to decode a "pdf2png" format image EG:
in your personal "delegates.mgk" file then use...
to use your own delgate method?
WARNING: delegate does not pass any "density" settings to ghostscript!!!!
If this works then "Tonytt98" can create his own delegates, seperate to the system degegates and will not need to effect other users on the system.
I will add this to the IM examples 'Image File Handimg' section, if I can get verification that it works.
How does IM determine if a delegate is unique, and how does it pick between
say a "pdf -> png" and the system "pdf -> eps" delegates?
Eg will adding a "pdf -> png" delegate cause it to be used as it is more direct?
Can you specify 'alturnate' input/output format delegates?
For example can we specify a delegate to decode a "pdf2png" format image EG:
Code: Select all
<delegate decode="pdf2png" encode="png" mode="bi" command=""gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -sDEVICE="pngalpha" -sOutputFile="%o" -f"%i"" />
Code: Select all
convert -density 300x300 pdf2png:file.pdf ...
WARNING: delegate does not pass any "density" settings to ghostscript!!!!
If this works then "Tonytt98" can create his own delegates, seperate to the system degegates and will not need to effect other users on the system.
I will add this to the IM examples 'Image File Handimg' section, if I can get verification that it works.
Last edited by anthony on 2006-09-20T23:03:58-07:00, edited 1 time in total.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
That is not what he refered it. Look at my last post above (end of page 1) about adding a new delegate for a "pdf2png" input image type. I'd like to know myself for IM Examples.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
ImageMagick only consults the delegates if the image format is not supported internally. Since PDF is, ImageMagick would never fire the png2pdf delegate. However, you could override this behavior with an an explicit custom tag. Lets declare a new image format called custom. First we edit delegates.xml and add
- <delegate decode="custom" command='"pdf2png" "%i" "%o"' />
- convert custom:image.pdf image.tif
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Thank you, that was what I was asking.
<delegate decode="pdf2png" ....>
then
convert pdf2png:image.pdf ....
<delegate decode="pdf2png" ....>
then
convert pdf2png:image.pdf ....
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
The above should work and you should be able to add it to your personal delegates.xml file in your home. It should not interfer with the system delegates as you finded a new 'input image format' called "pdf2png".
If this does not work we have a bug.
NOTE: the above does not pass any density or resolution options to GS, it is an example only at this point.
let us know how it goes.
If this does not work we have a bug.
NOTE: the above does not pass any density or resolution options to GS, it is an example only at this point.
let us know how it goes.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
The PDF/PS delegates are in a special format used internally. For PDF we use the ps:color delagate rather than ps:alpha because the pngalpha device only supports one page/one image and PDF's generally are multi-page and ImageMagick requires the delagate to return a multi-frame image format. If you use pdf2png you would need to concatenate all the PNG images into a multi-image format such as MNG, MIFF, TIFF, etc. For an example, see the pov delagate. You might be better off using Ghostscript directly and bypassing ImageMagick if you are attempting to get transparent PDF images.