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:
parent
47bf12cbac
commit
663922f93f
3 changed files with 36 additions and 11 deletions
|
@ -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>.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue