Open Bug 1771103 Opened 2 years ago Updated 2 years ago

SVG-as-an-image is quite blurry when used as CSS Background in a printed document, especially at reduced print scales

Categories

(Core :: Printing: Output, defect)

Desktop
All
defect

Tracking

()

Tracking Status
firefox-esr91 --- affected
firefox101 --- affected
firefox102 --- affected

People

(Reporter: csasca, Unassigned)

Details

Attachments

(9 files)

Affected versions

  • Firefox 91.10.0 ESR
  • Firefox 101.0
  • Firefox 102.0a1

Affected platforms

  • macOS 11.6.6
  • Windows 11
  • Ubuntu 22.04

Steps to reproduce

  1. Launch Firefox
  2. Access Wikipedia
  3. Print the page and check the "print background" setting
  4. Select from the Pages per sheet ~4 or more pages and print to pdf

Expected result

  • The content is not blurred out

Actual result

  • Some of the in page content is blurred out and the effect is stronger if selecting more pages per sheet.

Regression range

  • WIll see for a regression

Additional notes

Has STR: --- → yes
QA Whiteboard: [qa-regression-triage]

The blurry things are all background-images that are painted using this sprite sheet.

Reduced testcase coming up.

Here's a Save-to-PDF printout of testcase 1 (with the checkbox for "print backgrounds" checked).

The right copy of the image (the one with the CSS background) is noticeably blurrier. So something about our "paint svg image as CSS background" codepath is failing us here; we're painting at the wrong resolution or something.

Here's the testcase again, now with "Scale: 50%" chosen in the print preview dialog (similar to comment 0's described multiple-pages-per-sheet setup). This makes the blurriness more visible.

For convenience, here's a quick screenshot showing the blurriness in that most recent 50%-scale PDF printout.

Summary: Some in page contents will get blurrier if selecting more pages per sheet and printing the document → SVG Images are quite blurry when used as CSS Backgrounds, especially at reduced print scales
Attached file testcase 2

Testcase 2 uses "image-rendering: crisp-edges", which helps make it clearer that we're rasterizing the image at too small of a resolution and then scaling it up. (You can see the individual jaggy scaled-up pixel squares.)

Summary: SVG Images are quite blurry when used as CSS Backgrounds, especially at reduced print scales → SVG-as-an-image is quite blurry when used as CSS Background in a printed document, especially at reduced print scales

One would think that this would make it a crisp path?

With testcase 1 and testcase 2, I get this regression range:

Last good revision: 82df3654cd80 (2014-07-23)
First bad revision: a91ec42d6a9c (2014-07-24)
Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=82df3654cd80&tochange=a91ec42d6a9c

...but actual-Wikipedia still looks broken, so there's an additional factor that's triggering the pixellation there.

It looks like the relevant thing missing in my testcases (to trigger badness in older builds) is background-position -- if I set that to a nondefault value on testcase 2, then I get fuzziness even in my "good" 2014-07-23 nightly.

With background-position: -2px -8px added to the css-background part of testcase 2, it looks like I get "actual results" as far back as I can usefully test, which is around 2011-01-01, Firefox 4 prerelease builds.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #10)

One would think that this would make it a crisp path?

You would think, yeah! It looks like that was part of a fix for <img> being pixelated under some circumstances, in bug 1003505, which was a regression from bug 764299.

If I test a build from inside that range (the range when bug 1003505 was a problem), e.g. Nightly 2013-10-23 or 2014-06-20, then my PDF-printout of testcase 2 looks "consistently fuzzy" -- the top part (img) and bottom (css background) are both fuzzy. :)

But builds just-before or just-after that range look pretty much the same as they do now -- the top is crisp, the bottom is fuzzy.

--> Clearing regressionwindow-wanted since this is not really a regression, per comment 11. It goes back as far as I can usefully test.

Attachment #9279896 - Attachment description: testcase 1 (using sprite sheet as img vs CSS Bacgkround) → testcase 1 (using sprite sheet as img vs CSS Background)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: