Transparent background of images shows up as black when printed

RESOLVED FIXED

Status

()

RESOLVED FIXED
12 years ago
9 years ago

People

(Reporter: wgianopoulos, Assigned: vlad)

Tracking

({regression})

Trunk
x86
Windows XP
regression
Points:
---
Dependency tree / graph
Bug Flags:
blocking1.9 +
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(4 attachments)

(Reporter)

Description

12 years ago
When you print a web page that contains images with transparent backgrounds, the image background is always printed as black.

The page displays fine in print preview.  I have noticed this on various sites and with various printers.  The problem does not occur with Firefox 2.0.0.1.

The Yahoo! home page listed above is an example of a page with such an image.
Flags: blocking1.9?
(Reporter)

Comment 1

12 years ago
This testcase:

https://bugzilla.mozilla.org/attachment.cgi?id=216496

from bug 331941 also exhibits the issue.
(Reporter)

Comment 2

12 years ago
(In reply to comment #1)
> This testcase:
> 
> https://bugzilla.mozilla.org/attachment.cgi?id=216496
> 
> from bug 331941 also exhibits the issue.
> 

Hmm, oddly this testcase fails with Firefox 2.0.0.1 also, so perhaps there is an additional issue effecting .ico files.

However the http://www.yahoo.com prints correctly under Firefox 2.0.0.1, yet under current trunk, the Yahoo! logo image incorrectly prints with a black background.
(Reporter)

Comment 3

12 years ago
Created attachment 251529 [details]
Test PNG image that illustrates the issue

Printing the attached PNG image with current trunk shows the issue.  This image prints correctly with Firefox 2.0.0.1.
Assignee: nobody → pavlov
Flags: blocking1.9? → blocking1.9+

Comment 4

12 years ago
Created attachment 255470 [details]
PDF showing black background

In addition to transparent backgrounds in images showing up as black when printed, background of text appears black when printed. I used a "print to PDF" drive to create the attached PDF, but the Web page prints identically on my Canon  iP4200 printer. The original Web page is at http://waltonfeed.com/grain/faqs/ivb.html . Note in the PDF that the text and the palm tree graphic both have black backgrounds when they should be transparent.
Created attachment 261704 [details] [diff] [review]
only allow blits from screen DCs, never from printer DCs

This should fix it, though I'm not super happy about the patch.. but the chances of there being a printer driver that supports bitblt from its DC isn't very good, so this should be safe.
Assignee: pavlov → vladimir
Status: NEW → ASSIGNED
Attachment #261704 - Flags: review?(pavlov)

Updated

12 years ago
Attachment #261704 - Flags: review?(pavlov) → review+
Printing reftest, perhaps?
Flags: in-testsuite?
(Reporter)

Comment 8

12 years ago
And we have an automated way to print a page and scan it in and compare it with a previously printed and scanned image?
No; <http://lxr.mozilla.org/mozilla/source/layout/reftests/printing>.  I have no idea whether that would work here or not, but if it doesn't, there's surely another way to test this, even if it's harder to make it work.

Comment 10

12 years ago
(In reply to comment #9)
> <http://lxr.mozilla.org/mozilla/source/layout/reftests/printing>.

That wouldn't work; that renders to the screen.  (It's primarily meant for testing page breaking.)
Status: ASSIGNED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED

Comment 11

12 years ago
I did a test in the Gran Paradiso (beta 5) version and transparent background are not black but white.. Png tranparency seem still to be a problem !

Comment 12

12 years ago
(In reply to comment #11)
> I did a test in the Gran Paradiso (beta 5) version and transparent background
> are not black but white.. Png tranparency seem still to be a problem !

Please file a new bug with a testcase.
This is back in full force now that Cairo 1.5 has landed on the trunk.
Blocks: 383960
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Yea, it looks like the fix got reverted when Vlad next upgraded Cairo, though it was before cairo 1.5
Reapplied patch.  Missed it somehow when doing the cairo upgrade, sorry!
Status: REOPENED → RESOLVED
Last Resolved: 12 years ago12 years ago
Resolution: --- → FIXED

Comment 16

11 years ago
Created attachment 292802 [details]
Example of alpah transparency printing black on Firefox 2.0.0.11

This example uses alpha transparency instead of index transparency. The transparent area always prints solid black. Tested using Firefox 2.0.0.11 .

Comment 17

11 years ago
All tests of the index transparency were performed over the network using the following printers:

HP LaserJet 4000n
HP LaserJet CP4345xs
HP LaserJet CP3505dn

I noticed this bug is listed as resolved fixed, but it seems that might have been a bit premature, I hope someone is still watching this bug.

Comment 18

11 years ago
I, too, hope that someone is still watching this bug, as I am experiencing behavior that appears to be exactly this.

It appears to be fine on my linux box, but on my WinXP box, I am getting a black bar around the image.

There are probably other ways to get this, but this is how it is occurring for me.  I have tested some of the images attached to this and it appears to not be happening with the first image (turtle) but it is occurring with the last image (A)

STR:

1) Create a page with a canvas on it. 
2) Use toDataURL to convert the canvas to an image
3) Display the image URL, do a print preview and notice all looks fine
4) Print the image and notice the black bars/background/etc that should not be there

Expected: The printed version of the image should look like the print preview with no black showing
Observed: The printed version has a black box around the image, which is different than the print preview which does not show this.

Extra info:
WinXP Pro SP2
FF 2.0.0.14

As you can see, the behavior appears to be this bug.  If it is not, let me know and I'll gladly open a new one.
Leanan, this was about a bug that was happening on trunk (Firefox 3), so what you are experiencing with Firefox 2 is certainly not this bug.

Comment 20

9 years ago
Thunderbird 2.0.0.23 is producing the same result. Viewing the email and print previewing the email appear normal. Printing the transparent PNGs result in black backgrounds.

Extra info:
Win XP Pro
You need to log in before you can comment on or make changes to this bug.