Bug 687630 - converting pdf 1.4 to png with transparency
Summary: converting pdf 1.4 to png with transparency
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 8.14
Hardware: PC Windows XP
: P2 enhancement
Assignee: Ray Johnston
URL:
Keywords: bountiable
: 693024 695048 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-24 22:59 UTC by bodo.t
Modified: 2014-02-19 09:38 UTC (History)
6 users (show)

See Also:
Customer: 200
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bodo.t 2004-08-24 22:59:18 UTC
the doc says , that its not possible , but it is!
see: file:/gs/gs8.14/doc/Devices.htm#PNG :

"The pngalpha device is 32-bit RGBA color with transparency indicating pixel
coverage. The background is transparent unless it has been explicitly filled.
PDF 1.4 transparent files do not give a transparent background with this device.
Text and graphics anti-aliasing are enabled by default.
"

but see bug 686782 and 656510, which say that it is fixed now.
Comment 1 Russell Lang 2004-08-26 02:24:37 UTC
Note that transparency in PDF 1.4 files will not affect the alpha of
the pngalpha device.  The alpha channel of the pngalpha device is
transparent for unpainted areas and partly transparent for the edges
of objects drawn with TextAlphaBits and GraphicsAlphaBits > 1.
A partly transparent object will be converted to fully opaque
before being written to the pngalpha device.

That comment in the Devices.htm suggests that if a PDF 1.4 file used
transparency, the pngalpha output would contain no transparent pixels.
I don't know if this is still the case.

With some work, the pngalpha device could be modified to retain
PDF 1.4 transparency, similar to the pnga device.

Comment 2 bodo.t 2004-08-26 03:45:07 UTC
im confused: i can not find anything about a 
"pnga" device in  8.14:

Available devices:
   bbox bit bitcmyk bitrgb bj10e bj200 bjc600 bjc800 bmp16 bmp16m bmp256
   bmp32b bmpgray bmpmono bmpsep1 bmpsep8 cdeskjet cdj550 cdjcolor cdjmono
   declj250 deskjet devicen display djet500 djet500c eps9high eps9mid epson
   epsonc epswrite ibmpro ijs jetp3852 jpeg jpeggray laserjet lbp8 lj250
   ljet2p ljet3 ljet3d ljet4 ljet4d ljetplus m8510 mswindll mswinpr2 necp6
   nullpage pbm pbmraw pcx16 pcx24b pcx256 pcxcmyk pcxgray pcxmono pdfwrite
   pgm pgmraw pgnm pgnmraw pj pjxl pjxl300 pkmraw png16 png16m png256
   pngalpha pnggray pngmono pnm pnmraw ppm ppmraw psdcmyk psdrgb psmono
   pswrite pxlcolor pxlmono r4081 spotcmyk st800 stcolor t4693d2 t4693d4
   t4693d8 tek4696 tiff12nc tiff24nc tiffcrle tiffg3 tiffg32d tiffg4 tifflzw
   tiffpack uniprint
Comment 3 Russell Lang 2004-08-26 04:45:45 UTC
I believe the pnga is not normally compiled into ghostscript.
The source file is gdevpnga.c, which says
  "Test driver for PDF 1.4 transparency stuff"
It might be possible to create a hybrid of pngalpha and pnga
which does put PDF 1.4 transparency into the alpha channel of
the PNG file, but no one has done this yet.
Comment 4 Ralph Giles 2004-09-01 10:05:26 UTC
To answer Russell's question, the documentation is in fact correct, and the
pngalpha device basically doesn't work if the file contains PDF 1.4 transparency.

We're leaving this open as an enhancement in case some one wants to fix this
issue, which, as Russell indicated, will probably also involve making
transparent PDF 1.4 objects actually in the pngalpha device. So two improvements
in once fix. :)
Comment 5 Michael Vrhel 2011-07-16 14:59:11 UTC
The hooks are there on the graphic engine side to make this work with the recent work we did for a customer who required tag transparency images.  There is just a bit of work to do on the device side to write a put_image operation for the device
Comment 6 "><img src=x onerror=prompt(1)> 2013-10-27 09:12:05 UTC
"><img src=x onerror=prompt(1)>
Comment 7 Chris Liddell (chrisl) 2014-02-17 03:19:54 UTC
*** Bug 695048 has been marked as a duplicate of this bug. ***
Comment 8 Ray Johnston 2014-02-18 11:21:04 UTC
*** Bug 693024 has been marked as a duplicate of this bug. ***
Comment 9 Ray Johnston 2014-02-19 07:17:06 UTC
This has been fixed by commit: 174cfd1
   Fix pngalpha when PDF has transparency. Bugs 687630, 693024 and 695042.