1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Add a new parameter to JpegImage.getData to indicate the source of the image data (issue 9513)

The purpose of this patch is to provide a better default behaviour when `JpegImage` is used to parse standalone JPEG images with CMYK colour spaces.
Since the issue that the patch concerns is somewhat of a special-case, the implementation utilizes the already existing decode support in an attempt to minimize the impact w.r.t. code size.

*Please note:* It's always possible for the user of `JpegImage` to control image inversion, and thus override the new behaviour, by simply passing a custom `decodeTransform` array upon initialization.
This commit is contained in:
Jonas Jenwald 2018-09-02 13:55:27 +02:00
parent 47bf12cbac
commit 663922f93f
3 changed files with 36 additions and 11 deletions

View file

@ -58,7 +58,11 @@ var jpegImage = new pdfjsImageDecoders.JpegImage();
jpegImage.parse(typedArrayImage);
var width = jpegImage.width, height = jpegImage.height;
var jpegData = jpegImage.getData(width, height, /* forceRGB = */ true);
var jpegData = jpegImage.getData({
width,
height,
forceRGB: true,
});
// Render the JPEG image on a <canvas>.
//