canvas.imageSmoothingEnabled = "true"; produces undesirable interpolation / banding
Categories
(Core :: Graphics, defect, P3)
Tracking
()
People
(Reporter: colormatch, Unassigned)
Details
(Whiteboard: [geckoview:p3])
Attachments
(3 files)
User Agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0
Steps to reproduce:
- load https://kinoseed.com/
- click on "Load Image" area, and load the attached "stripe.png"
Actual results:
The loaded image looks choppy it has visible banding.
Expected results:
As the image with a single-pixel stripe is enlarged, and imageSmoothingEnabled is enabled, it is expected to produce smooth gradient.
Note that on PC/Win the interpolation is smooth, but on GeckoView (Firefox and GV-arr used in an app) there is banding.
Reporter | ||
Comment 1•5 years ago
|
||
Screenshot of PhotoMatch, using GeckoView 67.0.20190325125126 (beta), showing the same problem - banding.
Reporter | ||
Comment 2•5 years ago
|
||
For reference - Firefox on PC/Win does not show the same problem.
Reporter | ||
Comment 3•5 years ago
|
||
Here's example code: http://jsfiddle.net/mL0h8pra/
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Sending to the Graphics team's Bugzilla component because this looks like a graphics bug.
Reporter | ||
Comment 5•5 years ago
|
||
firefox68 (nightly 68.0a1) is affected too.
link for confirmation/test:
http://fiddle.jshell.net/mL0h8pra/show/
source code:
http://jsfiddle.net/mL0h8pra/
Comment 6•5 years ago
|
||
The priority flag is not set for this bug.
:jbonisteel, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•5 years ago
|
Comment 7•5 years ago
|
||
The banding is due to the fact that Skia uses fixed-point math in its bilinear filtering code. Due to the large amount of upscaling required, it is stressing the fixed-point precision limits. There is unfortunately nothing convenient we can do about this that I can think of.
A user workaround would be to create an image with enough of the gradient precomputed that is requires much less extreme upscaling than 100:1.
Reporter | ||
Comment 8•5 years ago
|
||
(In reply to Lee Salzman [:lsalzman] from comment #7)
The banding is due to the fact that Skia uses fixed-point math in its bilinear filtering code. Due to the large amount of upscaling required, it is stressing the fixed-point precision limits. There is unfortunately nothing convenient we can do about this that I can think of.
A user workaround would be to create an image with enough of the gradient precomputed that is requires much less extreme upscaling than 100:1.
Thanks for looking into it.
Maybe it will be good to have it fixed in the future?
Especially if someone uses the graphics engine for computational reasons.
If I'm not mistaken, Chrome also uses Skia, yet it does not show this problem at least when it comes to "resizing".
They do however show it after you getImageData and then putImageData:
example: http://jsfiddle.net/rj8d6ypv/show/
source code: http://jsfiddle.net/rj8d6ypv/
*note: Firefox 66 for desktop performs perfectly here - no issues.
Comment 9•2 years ago
|
||
The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.
Updated•2 years ago
|
Description
•