Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Issue 1302423004: Support lossy and lossless <canvas>.toDataURL for webp (Closed)

Created:
5 years, 3 months ago by Noel Gordon
Modified:
4 years, 7 months ago
Reviewers:
chrishtr, pdr., urvang, acterhd
CC:
blink-reviews, Rik, danakj, dshwang, drott+blinkwatch_chromium.org, krit, f(malita), jbroman, Justin Novosad, jzern, pdr+graphicswatchlist_chromium.org, rwlbuis, Stephen Chennney, vikasa
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Support lossy and lossless <canvas>.toDataURL for webp Deem "image/webp" to be an image format that supports alpha for the purposes of the HTML <canvas> spec. We no longer need to implement the composite-over-black requirement of the <canvas> spec since the image importer now includes the alpha channel always. If the image has no alpha, the libwebp encoder will notice and remove the alpha channel from the output (so the encoded image size is minimized). Add "image/webp.ll" (lossless webp) support. The toDataURL API user may optionally use the toDataURL quality argument to control encode speed. The default quality balances encoding speed with compression rate similar to the toDataURL PNG encoder. Note "image/webp.ll" is not a mimeType: it is an encoding selector. The toDataURL return result must contain the mimeType "image/webp". Layout tests added in this CL test this requirement. For "image/webp" at maximum quality, maintain sharpness (to match the toDataURL JPEG encoder) by using a better quality encoder. This is an internal detail of the user agent, one that might be changed to use libwebp::WebPPictureSmartARGBToYUVA() in future. Change in behavior: add new tests, update existing tests. fast/canvas/canvas-toBlob-webp-lossless.html fast/canvas/canvas-toDataURL-webp-alpha.html fast/canvas/canvas-toDataURL-webp-lossless.html fast/canvas/canvas-toDataURL-webp-maximum-quality.html fast/canvas/canvas-toDataURL-webp.html fast/canvas/toDataURL-supportedTypes.html This change include ideas and contributions from skal@, urvang@ and acterhd@ BUG=523098

Patch Set 1 #

Total comments: 11

Patch Set 2 : #

Patch Set 3 : Add new tests. #

Patch Set 4 : Add new tests, set expectations. #

Patch Set 5 : #

Total comments: 2

Patch Set 6 : Patch for landing. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+182 lines, -90 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 1 chunk +25 lines, -0 lines 0 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-webp-lossless.html View 1 2 3 4 5 1 chunk +39 lines, -0 lines 0 comments Download
M LayoutTests/fast/canvas/canvas-toDataURL-webp.html View 1 2 3 4 5 1 chunk +17 lines, -13 lines 0 comments Download
A + LayoutTests/fast/canvas/canvas-toDataURL-webp-alpha.html View 1 2 3 4 5 1 chunk +10 lines, -9 lines 0 comments Download
A + LayoutTests/fast/canvas/canvas-toDataURL-webp-lossless.html View 1 2 3 4 5 2 chunks +14 lines, -9 lines 0 comments Download
A + LayoutTests/fast/canvas/canvas-toDataURL-webp-maximum-quality.html View 1 2 3 4 5 2 chunks +14 lines, -9 lines 0 comments Download
M LayoutTests/fast/canvas/script-tests/canvas-toDataURL-case-insensitive-mimetype.js View 1 2 3 4 5 1 chunk +10 lines, -0 lines 0 comments Download
M LayoutTests/fast/canvas/toDataURL-supportedTypes.html View 1 2 3 4 5 1 chunk +6 lines, -4 lines 0 comments Download
M Source/core/html/HTMLCanvasElement.cpp View 1 2 1 chunk +3 lines, -5 lines 0 comments Download
M Source/platform/MIMETypeRegistry.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M Source/platform/graphics/ImageBuffer.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/platform/graphics/ImageBuffer.cpp View 1 2 3 4 5 3 chunks +16 lines, -5 lines 0 comments Download
M Source/platform/image-encoders/skia/WEBPImageEncoder.h View 1 1 chunk +4 lines, -1 line 0 comments Download
M Source/platform/image-encoders/skia/WEBPImageEncoder.cpp View 1 2 chunks +22 lines, -33 lines 0 comments Download

Messages

Total messages: 77 (13 generated)
Noel Gordon
https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp File Source/platform/image-encoders/skia/WEBPImageEncoder.cpp (right): https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode137 Source/platform/image-encoders/skia/WEBPImageEncoder.cpp:137: // terms of encoding speed and quality. _and_ filesize.
5 years, 3 months ago (2015-08-26 23:13:49 UTC) #1
Noel Gordon
https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp File Source/platform/image-encoders/skia/WEBPImageEncoder.cpp (right): https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode152 Source/platform/image-encoders/skia/WEBPImageEncoder.cpp:152: bool WEBPImageEncoder::encode(const SkBitmap& bitmap, int quality, Vector<unsigned char>* output, ...
5 years, 3 months ago (2015-08-26 23:43:14 UTC) #2
Noel Gordon
https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp File Source/platform/image-encoders/skia/WEBPImageEncoder.cpp (right): https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode138 Source/platform/image-encoders/skia/WEBPImageEncoder.cpp:138: config.quality = 75; FIXME: use WEBPImageEncoder::DefaultCompressionQuality here?
5 years, 3 months ago (2015-08-26 23:52:03 UTC) #3
Noel Gordon
> FIXME: since SkBitmap is being removed from chrome, ... Quick test: comment out that ...
5 years, 3 months ago (2015-08-26 23:57:34 UTC) #4
Noel Gordon
https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp File Source/platform/image-encoders/skia/WEBPImageEncoder.cpp (right): https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode152 Source/platform/image-encoders/skia/WEBPImageEncoder.cpp:152: bool WEBPImageEncoder::encode(const SkBitmap& bitmap, int quality, Vector<unsigned char>* output, ...
5 years, 3 months ago (2015-08-27 12:43:01 UTC) #5
acterhd
On 2015/08/27 12:43:01, noel gordon wrote: > https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp > File Source/platform/image-encoders/skia/WEBPImageEncoder.cpp (right): > > https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode152 ...
5 years, 3 months ago (2015-08-27 17:11:23 UTC) #6
acterhd
I think your idea, based in my, are not good. I'm recently updated code. Saved ...
5 years, 3 months ago (2015-08-27 17:18:19 UTC) #8
urvang
https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp File Source/platform/image-encoders/skia/WEBPImageEncoder.cpp (right): https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode129 Source/platform/image-encoders/skia/WEBPImageEncoder.cpp:129: config.method = (quality * 6) / 100; Large method ...
5 years, 3 months ago (2015-08-27 17:18:24 UTC) #10
acterhd
On 2015/08/27 17:18:24, urvang wrote: > https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp > File Source/platform/image-encoders/skia/WEBPImageEncoder.cpp (right): > > https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode129 > ...
5 years, 3 months ago (2015-08-27 17:22:29 UTC) #11
acterhd
Okay, noel. Just copy-paste my code to your patch, and I'm delete my variant.
5 years, 3 months ago (2015-08-28 11:05:10 UTC) #12
Noel Gordon
On 2015/08/28 11:05:10, acterhd wrote: > Okay, noel. Just copy-paste my code to your patch, ...
5 years, 3 months ago (2015-08-28 11:20:37 UTC) #13
Noel Gordon
On 2015/08/27 17:18:24, urvang wrote: > > On 2015/08/26 23:43:14, noel gordon wrote: > > ...
5 years, 3 months ago (2015-08-28 11:25:00 UTC) #14
acterhd
On 2015/08/28 11:20:37, noel gordon wrote: > On 2015/08/28 11:05:10, acterhd wrote: > > Okay, ...
5 years, 3 months ago (2015-08-28 11:25:53 UTC) #15
acterhd
On 2015/08/28 11:25:53, acterhd wrote: > On 2015/08/28 11:20:37, noel gordon wrote: > > On ...
5 years, 3 months ago (2015-08-28 11:26:27 UTC) #16
Noel Gordon
On 2015/08/28 11:26:27, acterhd wrote: > lgtm Read https://www.chromium.org/developers/contributing-code to work how to contribute code, ...
5 years, 3 months ago (2015-08-28 11:53:58 UTC) #17
acterhd
On 2015/08/28 11:53:58, noel gordon wrote: > On 2015/08/28 11:26:27, acterhd wrote: > > lgtm ...
5 years, 3 months ago (2015-08-28 12:02:05 UTC) #18
acterhd
On 2015/08/28 12:02:05, acterhd wrote: > On 2015/08/28 11:53:58, noel gordon wrote: > > On ...
5 years, 3 months ago (2015-08-28 12:39:29 UTC) #19
acterhd
On 2015/08/28 12:39:29, acterhd wrote: > On 2015/08/28 12:02:05, acterhd wrote: > > On 2015/08/28 ...
5 years, 3 months ago (2015-08-28 12:42:40 UTC) #20
acterhd
On 2015/08/28 12:42:40, acterhd wrote: > On 2015/08/28 12:39:29, acterhd wrote: > > On 2015/08/28 ...
5 years, 3 months ago (2015-08-28 12:43:17 UTC) #21
acterhd
On 2015/08/28 12:43:17, acterhd wrote: > On 2015/08/28 12:42:40, acterhd wrote: > > On 2015/08/28 ...
5 years, 3 months ago (2015-08-28 12:44:04 UTC) #22
acterhd
On 2015/08/28 12:44:04, acterhd wrote: > On 2015/08/28 12:43:17, acterhd wrote: > > On 2015/08/28 ...
5 years, 3 months ago (2015-08-28 13:08:59 UTC) #23
acterhd
On 2015/08/28 13:08:59, acterhd wrote: > On 2015/08/28 12:44:04, acterhd wrote: > > On 2015/08/28 ...
5 years, 3 months ago (2015-08-28 13:11:11 UTC) #24
Noel Gordon
On 2015/08/28 12:44:04, acterhd wrote: > On 2015/08/28 12:43:17, acterhd wrote: > > On 2015/08/28 ...
5 years, 3 months ago (2015-08-28 13:14:56 UTC) #25
acterhd
On 2015/08/28 13:14:56, noel gordon wrote: > On 2015/08/28 12:44:04, acterhd wrote: > > On ...
5 years, 3 months ago (2015-08-28 13:23:07 UTC) #26
Noel Gordon
On 2015/08/28 13:23:07, acterhd wrote: > I removed my issue. I better re-think about publication ...
5 years, 3 months ago (2015-08-28 13:29:58 UTC) #27
acterhd
On 2015/08/28 13:29:58, noel gordon wrote: > On 2015/08/28 13:23:07, acterhd wrote: > > I ...
5 years, 3 months ago (2015-08-29 13:10:32 UTC) #28
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1302423004/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1302423004/40001
5 years, 3 months ago (2015-08-31 08:21:55 UTC) #30
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/106579)
5 years, 3 months ago (2015-08-31 09:33:45 UTC) #32
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1302423004/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1302423004/60001
5 years, 3 months ago (2015-08-31 12:31:35 UTC) #34
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 3 months ago (2015-08-31 12:36:00 UTC) #36
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1302423004/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1302423004/100001
5 years, 3 months ago (2015-09-01 05:48:34 UTC) #39
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 3 months ago (2015-09-01 06:20:08 UTC) #41
Noel Gordon
On 2015/08/27 17:18:24, urvang wrote: > https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp > File Source/platform/image-encoders/skia/WEBPImageEncoder.cpp (right): > > https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode129 > ...
5 years, 3 months ago (2015-09-01 13:24:39 UTC) #42
acterhd
On 2015/09/01 13:24:39, noel gordon wrote: > On 2015/08/27 17:18:24, urvang wrote: > > > ...
5 years, 3 months ago (2015-09-01 13:35:40 UTC) #43
urvang
On 2015/09/01 13:24:39, noel gordon wrote: > On 2015/08/27 17:18:24, urvang wrote: > > > ...
5 years, 3 months ago (2015-09-01 19:47:57 UTC) #44
urvang
lgtm https://codereview.chromium.org/1302423004/diff/100001/LayoutTests/fast/canvas/toDataURL-supportedTypes.html File LayoutTests/fast/canvas/toDataURL-supportedTypes.html (left): https://codereview.chromium.org/1302423004/diff/100001/LayoutTests/fast/canvas/toDataURL-supportedTypes.html#oldcode28 LayoutTests/fast/canvas/toDataURL-supportedTypes.html:28: "image/gif", Curious: How was "image/gif" working before?
5 years, 3 months ago (2015-09-01 19:54:08 UTC) #45
Noel Gordon
https://codereview.chromium.org/1302423004/diff/100001/LayoutTests/fast/canvas/toDataURL-supportedTypes.html File LayoutTests/fast/canvas/toDataURL-supportedTypes.html (left): https://codereview.chromium.org/1302423004/diff/100001/LayoutTests/fast/canvas/toDataURL-supportedTypes.html#oldcode28 LayoutTests/fast/canvas/toDataURL-supportedTypes.html:28: "image/gif", On 2015/09/01 19:54:08, urvang wrote: > Curious: How ...
5 years, 3 months ago (2015-09-01 23:20:26 UTC) #46
Noel Gordon
On 2015/09/01 19:47:57, urvang wrote: > On 2015/09/01 13:24:39, noel gordon wrote: > https://codereview.chromium.org/1302423004/diff/1/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp#newcode140 > ...
5 years, 3 months ago (2015-09-02 00:38:45 UTC) #47
Noel Gordon
Also as discussed, changed the encoder selector to be "image/webp.ll" everywhere.
5 years, 3 months ago (2015-09-02 00:43:00 UTC) #48
Noel Gordon
On 2015/09/01 19:54:08, urvang wrote: > lgtm Updated changelog, tests passing locally for me. PTAL.
5 years, 3 months ago (2015-09-02 01:09:55 UTC) #50
pdr.
Why are we doing this through the type argument instead of using additional quality control ...
5 years, 3 months ago (2015-09-02 02:22:34 UTC) #52
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1302423004/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1302423004/120001
5 years, 3 months ago (2015-09-02 03:50:04 UTC) #54
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 3 months ago (2015-09-02 03:54:53 UTC) #56
acterhd
On 2015/09/02 03:54:53, commit-bot: I haz the power wrote: > Dry run: This issue passed ...
5 years, 3 months ago (2015-09-02 06:06:37 UTC) #57
acterhd
On 2015/09/02 06:06:37, acterhd wrote: > On 2015/09/02 03:54:53, commit-bot: I haz the power wrote: ...
5 years, 3 months ago (2015-09-02 06:08:51 UTC) #58
Noel Gordon
On 2015/09/02 06:08:51, acterhd wrote: > > noel, why not do like in my patch? ...
5 years, 3 months ago (2015-09-02 13:15:26 UTC) #59
acterhd
On 2015/09/02 13:15:26, noel gordon wrote: > On 2015/09/02 06:08:51, acterhd wrote: > > > ...
5 years, 3 months ago (2015-09-02 13:23:56 UTC) #60
acterhd
On 2015/09/02 13:23:56, acterhd wrote: > On 2015/09/02 13:15:26, noel gordon wrote: > > On ...
5 years, 3 months ago (2015-09-02 13:29:41 UTC) #61
acterhd
I removed own patch. Good luck, noel!
5 years, 3 months ago (2015-09-03 12:14:32 UTC) #62
Noel Gordon
On 2015/09/03 12:14:32, acterhd wrote: > I removed own patch. Good luck, noel! And thanks ...
5 years, 3 months ago (2015-09-04 01:02:57 UTC) #63
Noel Gordon
On 2015/09/02 02:22:34, pdr wrote: > Why are we doing this through the type argument ...
5 years, 3 months ago (2015-09-07 02:39:22 UTC) #64
skal
> aside: @skal, no IANA register mimes for webp? mostly: lack of time to write ...
5 years, 3 months ago (2015-09-07 20:51:51 UTC) #65
pdr.
On 2015/09/07 at 02:39:22, noel wrote: > On 2015/09/02 02:22:34, pdr wrote: > > Why ...
5 years, 3 months ago (2015-09-08 21:03:28 UTC) #66
Noel Gordon
Compression settings? The webp encoder has many such settings [1] https://code.google.com/p/chromium/codesearch#chromium/src/third_party/libwebp/enc/config.c&l=27&q=third_party/libwebp/enc/config.c%20config-%3Equality and here I don't ...
5 years ago (2015-11-30 10:02:30 UTC) #67
pdr.
On 2015/11/30 at 10:02:30, noel wrote: > Compression settings? The webp encoder has many such ...
5 years ago (2015-11-30 17:17:55 UTC) #68
Ken Russell (switch to Gerrit)
On 2015/11/30 17:17:55, pdr wrote: > On 2015/11/30 at 10:02:30, noel wrote: > > Compression ...
5 years ago (2015-12-08 23:11:37 UTC) #69
pdr.
On 2015/12/08 at 23:11:37, kbr wrote: > On 2015/11/30 17:17:55, pdr wrote: > > On ...
5 years ago (2015-12-08 23:17:18 UTC) #70
pdr.
Oops, for your second question "Should a 1.0 value for encoderOptions just imply the lossless ...
5 years ago (2015-12-08 23:49:19 UTC) #71
Noel Gordon
On 2015/11/30 17:17:55, pdr wrote: > On 2015/11/30 at 10:02:30, noel wrote: > > Compression ...
5 years ago (2015-12-09 15:21:11 UTC) #72
Noel Gordon
On 2015/12/08 23:11:37, Ken Russell wrote: > On 2015/11/30 17:17:55, pdr wrote: > > On ...
5 years ago (2015-12-09 16:15:20 UTC) #73
Noel Gordon
On 2015/12/08 23:11:37, Ken Russell wrote: > Philip, do you have a suggestion about how ...
5 years ago (2015-12-09 16:41:23 UTC) #74
Noel Gordon
On 2015/12/08 23:17:18, pdr wrote: > How about adding "webp" to this list: > http://www.w3.org/html/wg/drafts/html/master/semantics.html#canvas-serialisation-arguments ...
5 years ago (2015-12-09 16:43:06 UTC) #75
Noel Gordon
On 2015/12/08 23:49:19, pdr wrote: > Oops, for your second question "Should a 1.0 value ...
5 years ago (2015-12-09 17:08:37 UTC) #76
Noel Gordon
5 years ago (2015-12-09 17:11:36 UTC) #77
> a dict will require spec-level text as we known.

meant, "as we know", kaibia.

Powered by Google App Engine
This is Rietveld 408576698