Closed Bug 1782877 Opened 2 years ago Closed 2 years ago

canvas.toDataURL("image/webp", 1.0); not properly implementing LOSSLESS webp

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 103
defect

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: stephen.ehlers, Assigned: tnikkel)

Details

Attachments

(2 files)

Attached file LosslessExample.html

Steps to reproduce:

  1. Build Graphic with canvas rendering 2d context.
  2. Grab raw bytes from getImageData.
  3. Call canvas toDataUrl("image/png", 1)
  4. Populate an image element src with the url;
  5. Use the image as the source to for a drawImage call on a 2d context.
  6. Grab raw bytes from png sourced rendering by doing a second getImageData call on your 2d context.
  7. Compare original bytes to lossless png bytes (success).

Repeat 1-7 but on step 3 instead use toDataUrl("image/webp", 1) .

Actual results:

The byte comparison for PNG and the Original bytes match 100%, meaning it was truly a lossless conversion.

The byte comparison for WebP will show mismatches, meaning that the conversion had data loss.

Expected results:

Both PNG and WebP formats with a quality/precision or 1 (lossless) should result in identical bytes to the original image.

Expected results should say "of 1" not "or 1".

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: Canvas2D
Product: Firefox → Core

Chrome and Safari do, and it makes sense.

Assignee: nobody → tnikkel
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Pushed by tnikkel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cc6e6cb510c5
Encoding webp with quality 100 should use lossless. r=aosmond
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: