createImageBitmap() ignores sx,sy,sw,sh parameters when using resize option
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
People
(Reporter: serguei.ivantsov, Assigned: lsalzman)
References
(Regression)
Details
(Keywords: dev-doc-complete, regression)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:147.0) Gecko/20100101 Firefox/147.0
Steps to reproduce:
Using the sample 50x50 image from the manual, let's try to crop it:
createImageBitmap(image, 40, 40, 10, 10, {
resizeWidth: 50,
resizeHeight: 50,
resizeQuality: 'pixelated',
})
Actual results:
resulting image is original image
Expected results:
resulting image should be cropped using 10x10px from the right-bottom of original image and scaled to 50x50px
this works properly in Safari and Chrome
Comment 1•3 months ago
|
||
Updated•3 months ago
|
Comment 2•3 months ago
|
||
Hello, thank you for the bug report!
I managed to reproduce this issue on:
- Firefox Nightly 149.0a1;
- Firefox 148.0b5;
Tested and reproduced on:
- Windows 10;
- Ubuntu 22;
- macOS 15;
Setting as NEW.
Comment 3•3 months ago
|
||
The severity field is not set for this bug.
:lsalzman, could you have a look please?
For more information, please visit BugBot documentation.
Comment 4•3 months ago
|
||
The severity field is not set for this bug.
:lsalzman, could you have a look please?
For more information, please visit BugBot documentation.
| Assignee | ||
Updated•3 months ago
|
Comment 5•3 months ago
|
||
Set release status flags based on info from the regressing bug 1733559
Updated•3 months ago
|
| Assignee | ||
Comment 6•3 months ago
|
||
Updated•3 months ago
|
Comment 8•2 months ago
|
||
| bugherder | ||
Comment 9•1 month ago
|
||
FF149 MDN docs for this can be tracked in https://github.com/mdn/content/issues/43429
Looking at the discussion and changes, what I think this delivers is full support for the options.resizeQuality in Window.createImageBitmap() and WorkerGlobalScope.createImageBitmap(). Previously if a value was set for this property the function just returned the original bitmap. Is that right?
Is there a particular release note you would like? Note that the compatibility data appears to already have been updated.
| Reporter | ||
Comment 10•1 month ago
|
||
(In reply to Hamish Willee from comment #9)
Looking at the discussion and changes, what I think this delivers is full support for the
options.resizeQualityinWindow.createImageBitmap()and [WorkerGlobalScope.createImageBitmap()]
Hi, not exactly. Before either (sx, sy, sw, sh) or options.resize* parameters worked, i.e. not simultaneously.
Comment 11•1 month ago
•
|
||
Hi @Serguei, So I the reason I assumed that this added support for options.resizeQuality was because:
- The WebIDL seems to have added this option in this issue, which also added the Enum for the options and so on - see https://github.com/mozilla-firefox/firefox/commit/e252b0e324b1#diff-2d17dae6ae7be7746e1db91d27dd55a017a97823d7e6a7c79d4d0f3130cef30c
- The compatibility tests spotted the existance of this option for the first time https://github.com/mdn/browser-compat-data/pull/29135/changes#diff-0c05570d9108608f1e8895adaba621feb7ab86f1f793195f329273c40cd798e9R284
So just to be very clear the browser compat data is wrong? You could always specify options.resizeQuality and it would be used - just not with (sx, sy, sw, sh) also used? (I ask, because I'll need to get the compatibility data looked at).
Worries me a bit. I thought I knew how to interpret IDL updates :-(
| Reporter | ||
Comment 12•1 month ago
|
||
Sorry for confusion.
Original report was about (sx, sy, sw, sh) and options.resize* did not work together.
I.e. it was not possible crop and resize in a single call. Regardless of resizeQuality.
But I just checked the commit, and found that resizeQuality is also fixed - before it was ignored.
So there are two fixes here.
Maybe @lsalzman can explain better.
Comment 13•1 month ago
|
||
@Serguei - thanks very much. That is consistent with what I was seeing (i.e. a good explanation). I'll proceed with this, but leave the request open for @lsalzman just in case there is more to add.
Updated•1 month ago
|
| Assignee | ||
Comment 14•1 month ago
|
||
(In reply to Serguei Ivantsov from comment #12)
Sorry for confusion.
Original report was about (sx, sy, sw, sh) and options.resize* did not work together.
I.e. it was not possible crop and resize in a single call. Regardless of resizeQuality.
But I just checked the commit, and found that resizeQuality is also fixed - before it was ignored.
So there are two fixes here.
Maybe @lsalzman can explain better.
So I did indeed fix resizeWidth and resizeHeight to work properly. But during testing, resizeQuality being broken was also preventing me from testing it properly. Given that fixing resizeQuality to thus work was such a small change, I just went ahead and fixed it to get the tests passing.
Description
•