Commit c8dfe59b authored by Isabella Scalzi's avatar Isabella Scalzi Committed by Commit Bot

[piexwasm] Use MIME type in |request.js|

Use the mimeType property that was sent from piex_loader.js to prevent
lossy JPEG encoding of images that are of type BMP.

Bug: 1039141
Change-Id: I1ee989bb8c2627cd5fba282dd7bb0b7214b48f54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2060358
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742035}
parent 63fa2bf1
...@@ -310,10 +310,8 @@ ImageRequest.prototype.downloadOriginal_ = function(onSuccess, onFailure) { ...@@ -310,10 +310,8 @@ ImageRequest.prototype.downloadOriginal_ = function(onSuccess, onFailure) {
this.request_.orientation = data.orientation; this.request_.orientation = data.orientation;
this.request_.colorSpace = data.colorSpace; this.request_.colorSpace = data.colorSpace;
this.ifd_ = data.ifd; this.ifd_ = data.ifd;
// TODO(1039141): if piex-wasm is updated to return more than this.contentType_ = data.mimeType;
// just JPEG then it should indicate the image mimeType so we const blob = new Blob([data.thumbnail], {type: data.mimeType});
// can set this.contentType_.
const blob = new Blob([data.thumbnail], {type: 'image/jpeg'});
this.image_.src = URL.createObjectURL(blob); this.image_.src = URL.createObjectURL(blob);
}.bind(this), }.bind(this),
function() { function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment