Last Comment Bug 235097 - [printing] png transparency mishandled (to file or to printer)
: [printing] png transparency mishandled (to file or to printer)
Status: RESOLVED DUPLICATE of bug 191099
:
Product: Core
Classification: Components
Component: Printing: Output (show other bugs)
: Trunk
: x86 All
: -- normal with 5 votes (vote)
: ---
Assigned To: printing
:
: Jet Villegas (:jet)
Mentors:
http://www.darkknight.net/contact/ind...
: 310288 311233 314153 315079 340541 345963 366855 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-02-20 20:34 PST by Brian Beaudoin
Modified: 2008-12-13 16:13 PST (History)
20 users (show)
asa: blocking‑aviary1.5-
mconnor: blocking1.8.1-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Output sample from Firefox on Linux (9.24 KB, application/pdf)
2004-02-20 20:39 PST, Brian Beaudoin
no flags Details
Output sample from Firefox on Windows (34.42 KB, application/pdf)
2004-02-20 20:41 PST, Brian Beaudoin
no flags Details
Correct output from (surprisingly) MSIE (28.40 KB, application/pdf)
2004-02-20 20:43 PST, Brian Beaudoin
no flags Details
Another example of incorrect output, Firefox 1.5b on Windows (21.49 KB, application/pdf)
2005-09-28 06:08 PDT, Domagoj Cosic
no flags Details
Test case and result (204.63 KB, application/zip)
2006-06-06 23:53 PDT, Disorn Homchuenchom
no flags Details
Patch fixing the png transparency problem in postscript output (obsolete gfx/ps) (3.61 KB, patch)
2006-11-16 14:23 PST, Dov Grobgeld
no flags Details | Diff | Splinter Review

Description Brian Beaudoin 2004-02-20 20:34:47 PST
User-Agent:       
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040207 Firefox/0.8

PNG images with alpha transparency are printed as if against a solid black
background (regardless of the page or image background color).  PNG images with
binary transparency seem to be handled correctly. 
http://www.darkknight.net/contact/index.html contains PNG images of both types.

Reproducible: Always
Steps to Reproduce:
1. Load a web page (sample given) in the Firefox browser
2. Print the page (to file or to printer)
3. Examine the output

Actual Results:  
On Linux, PNG images with alpha transparency are not reproduced at all (printing
of background images and colors was enabled).  Images with binary transparency
printed correctly.  Images with alpha transparency showed black banding or were
completely black (depending on content).

Expected Results:  
A better behavior would be to composite the images against white first (this
would at least save toner).  Firefox should actually composite the image first
unless the printer driver can be verified to support alpha transparency.  Images
used as backgrounds should be reproduced when the option to do so is selected.
Comment 1 Brian Beaudoin 2004-02-20 20:39:40 PST
Created attachment 141865 [details]
Output sample from Firefox on Linux

In page setup, selected "Print Background (colors & images), then printed the
page to a file.  This matched with the hard copy.

Converted the file to PDF format with 'ps2pdf mozilla.ps firefox_linux.pdf' to
simplify viewing across platforms.
Comment 2 Brian Beaudoin 2004-02-20 20:41:27 PST
Created attachment 141866 [details]
Output sample from Firefox on Windows

In page setup, selected "Print Background (colors & images), then printed the
page to the printer.  Printed the page again using Adobe Acrobat 6.0
Professional.
Comment 3 Brian Beaudoin 2004-02-20 20:43:12 PST
Created attachment 141867 [details]
Correct output from (surprisingly) MSIE

MSIE not only surprised me by displaying the images correctly, but it also
printed them correctly to hard copy and to PDF.
Comment 4 Andrew Schultz 2004-02-22 07:39:27 PST
confirmed with linux trunk 20040220
see also bug 141656
(ps, xprint both do the same thing here)

reassigning
Comment 5 Ben Goodger (use ben at mozilla dot org for email) 2005-02-11 15:24:16 PST
This bug may be causing Google Map direction lines to print poorly in Firefox,
e.g. if there is a line showing the path of travel it is printed with a black
background. 
Comment 6 Kenneth Herron 2005-09-28 05:31:56 PDT
*** Bug 310288 has been marked as a duplicate of this bug. ***
Comment 7 Domagoj Cosic 2005-09-28 06:08:34 PDT
Created attachment 197693 [details]
Another example of incorrect output, Firefox 1.5b on Windows

PDF-Printout of
http://www.bundeswahlleiter.de/bundestagswahl2005/ergebnisse/bundesergebnisse/grafik_sitze_99.html
Comment 8 j.j. 2005-09-28 13:59:58 PDT
If Bug 310288 is a duplicate, OS should be changed to ALL.
Comment 9 Elmar Ludwig 2005-10-05 14:43:42 PDT
*** Bug 311233 has been marked as a duplicate of this bug. ***
Comment 10 zug_treno 2005-10-29 03:42:18 PDT
*** Bug 314153 has been marked as a duplicate of this bug. ***
Comment 11 Elmar Ludwig 2005-11-04 07:42:44 PST
*** Bug 315079 has been marked as a duplicate of this bug. ***
Comment 12 Domagoj Cosic 2005-12-21 13:43:05 PST
http://www.bundeswahlleiter.de/bundestagswahl2005/ergebnisse/bundesergebnisse/grafik_sitze_99.html

has no transparency any more. We decided to make background white opaque to prevent the problem, so it cannot be used as test case any more.
Comment 13 Mike Connor [:mconnor] 2006-01-10 08:33:39 PST
There are plans for some core layout issues with printing that will be addressed for Gecko 1.9, but not on branch.
Comment 14 Tracy Walker [:tracy] 2006-06-06 13:06:22 PDT
*** Bug 340541 has been marked as a duplicate of this bug. ***
Comment 15 Disorn Homchuenchom 2006-06-06 16:34:48 PDT
Does this occur because of the SVG file?
My test (duplicate bug) is on Wikipedia site (http://en.wikipedia.org/wiki/DVI).
In this page you can see 2 pictures of DVI connector (one on the top of the page, another in the middle of the page).
I clicked the first one to see its preview but only saw a transparency grid (like you see in Photoshop, all white on IE), then clicked it again oh, I got the picture.
On the other hand, the second picture was clicked, previewed (also see transparecy grid with connectors) and displayed all correctly but incorrect printed.

I don't know how related about SVG and PNG but this 2 images include 'transparency'.
Comment 16 Disorn Homchuenchom 2006-06-06 23:53:08 PDT
Created attachment 224664 [details]
Test case and result

Clearly that Firefox cannot handle PNG picture correctly when copying and printing.
Comment 17 Disorn Homchuenchom 2006-06-06 23:55:08 PDT
Add to previous comment:
I find out that not only the picture I mentioned is printed in black, all the PNG image files in that page are also printed in black, too.
"I observe that they are only printed in black on their edge (area outside the connector edge)." Hope this can help solving this bug.
Comment 18 Jeremy Morton 2006-07-15 02:11:27 PDT
Gawd, I can't believe this bug *still* hasn't been fixed by Firefox 2 (or Bon Echo, at least).  I think it should be made a blocker as it's quite a ridiculous thing that Firefox can render something to screen but not to a printer.
Comment 19 Mike Connor [:mconnor] 2006-07-16 11:53:23 PDT
Its more than a little late to rearchitect printing on the branch, but I think you know that.  Cairo might fix this, but that's Fx3
Comment 20 Frank Wein [:mcsmurf] 2006-07-26 05:49:28 PDT
*** Bug 345963 has been marked as a duplicate of this bug. ***
Comment 21 Dov Grobgeld 2006-11-16 14:23:41 PST
Created attachment 245787 [details] [diff] [review]
Patch fixing the png transparency problem in postscript output (obsolete gfx/ps)

This patch does a color mixing of the color white and the pixel value by a mixing ratio determined by the alpha value of the pixel. This should work as long as there is no background color. I have tested it on all the various png images that I found around the Internet and it seems to solve the ugly printing problem.

(My first patch to Mozilla. :-)
Comment 22 Eli Friedman 2007-01-04 14:33:25 PST
(In reply to comment #21)
> Created an attachment (id=245787) [details]
> Patch fixing the png transparency problem in postscript output
> 
> (My first patch to Mozilla. :-)
> 

If you want to get people to notice a patch, you generally have to ask.  See http://www.mozilla.org/hacking/life-cycle.html.  It's kind of sad that patches slip through the cracks like this, but that's the way it works at the moment.

In this case, your patch is already out of date, because that codepath is no longer used.  The new graphics code is in gfx/src/thebes.
Comment 23 timeless 2007-07-05 01:06:03 PDT
*** Bug 366855 has been marked as a duplicate of this bug. ***
Comment 24 timeless 2007-07-05 01:22:44 PDT

*** This bug has been marked as a duplicate of bug 191099 ***
Comment 25 Jeremy Morton 2008-12-13 16:13:19 PST
I've investigated this, and come to the conclusion that Firefox's behaviour is
correct, and Google Maps' code is incorrect.  My full explanation is here:
http://www.game-point.net/misc/googlemaps/

Please bug Google Maps to fix their code.  I have no idea why they tell the
browser to print non-transparent GIFs instead of the perfectly good transparent
PNGs used on the browser screen.

Note You need to log in before you can comment on or make changes to this bug.