Closed Bug 1731534 Opened 3 years ago Closed 3 years ago

`image-rendering:pixelated` not working as documented when downscaling

Categories

(Firefox :: Untriaged, defect)

Firefox 93
defect

Tracking

()

RESOLVED DUPLICATE of bug 1731134

People

(Reporter: 543080122, Unassigned)

Details

Attachments

(2 files, 5 obsolete files)

Attached file pixelated bug.html (obsolete) —

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0

Steps to reproduce:

The rendering method pixelated is (according to https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering)

When scaling the image up, the nearest-neighbor algorithm must be used, so that the image appears to be composed of large pixels. When scaling down, this is the same as auto.

Actual results:

It also affect downscaling incorrectly

Expected results:

It should not touch downscaling

Attached image Result.png (obsolete) —
Attached file pixelated bug.html (obsolete) —

alt fix

Attachment #9242007 - Attachment is obsolete: true

Looks like the documentation is wrong. The specification says nothing about downscaling: https://drafts.csswg.org/css-images/#the-image-rendering

(In reply to Robert Longson [:longsonr] from comment #3)

Looks like the documentation is wrong. The specification says nothing about downscaling: https://drafts.csswg.org/css-images/#the-image-rendering

As shown in the image attachment, pixel art looks much better when scale up with nearest neighbor

But when talking about downscaling, It lost too much information that you barely understand what that emoji is if nearest neighbor is used

That's when smoother algorithm should be used as mentioned in the w3c doc

but allows minor smoothing instead of awkward distortion when necessary.

Summary: Regression bug of image-rendering:pixelated not working as documented → Regression bug of image-rendering:pixelated not working as documented when downscaling
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE

I'm fairly confused. The attached HTML doesn't use image-rendering at all? Neither pixelated nor -moz-crisp-edges. Can you attach a test-case that uses it so that I can take a closer look?

Note that we didn't use to implement image-rendering: pixelated at all, so perhaps this is a regression from bug 856337?

Status: RESOLVED → REOPENED
Flags: needinfo?(543080122)
Resolution: DUPLICATE → ---

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

I'm fairly confused. The attached HTML doesn't use image-rendering at all? Neither pixelated nor -moz-crisp-edges. Can you attach a test-case that uses it so that I can take a closer look?

Note that we didn't use to implement image-rendering: pixelated at all, so perhaps this is a regression from bug 856337?

Sorry I must be messed it up in the last upload, updated the html demo now

I checked bug 856337, it said pixelated was implemented in build 93.0a1 (20210903160420), I downloaded 94.0a1 (20211002213629) and tested it with the demo, but when using image-rendering: pixelated, downscaled image is still jagged

I'm not sure what's going on here, is it me downloaded the wrong version that didn't fixed the issue or this is the final state of pixelated that Mozilla thinks how it should works?

Attachment #9242009 - Attachment is obsolete: true
Flags: needinfo?(543080122)

fix typo

Attachment #9244088 - Attachment is obsolete: true

fix wrong content type... 🤦‍♂️

Attachment #9244089 - Attachment is obsolete: true

What were you using in comment 1 to get that rendering in 92b9? Pixelated obviously didn't parse then, were you using crisp-edges? something else?

Flags: needinfo?(543080122)
Attached image Result.png

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

What were you using in comment 1 to get that rendering in 92b9? Pixelated obviously didn't parse then, were you using crisp-edges? something else?

I tested it again, you're right, pixelated is not implemented then, I must be mixed it with wrong memory or something

What happened is that I was using img {image-rendering: pixelated;} in userContent.css all the time, waiting for its implementation. It was too long that I forget about it already, so when 93 finally implement pixelated after all but not in the way I expected, I noticed its bad downscaling right away.

So this is a bug about pixelated but not a regression one

Attachment #9242008 - Attachment is obsolete: true
Flags: needinfo?(543080122)

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

What were you using in comment 1 to get that rendering in 92b9? Pixelated obviously didn't parse then, were you using crisp-edges? something else?

Summary: Regression bug of image-rendering:pixelated not working as documented when downscaling → `image-rendering:pixelated` not working as documented when downscaling

Ok, then I think this is just bug 1731134. When downscaling we could use a better algorithm

Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: