Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 2, 2018

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Sep 2, 2018

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.

Edit: I should probably add that all of this feels hand-wavy, at least to me, as far as solutions go...

…n a regular function

Given how `_isColorConversionNeeded` is used, and that it always returns a boolean value, having it be a getter seems more appropriate.
…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.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Sep 2, 2018

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/17904e3f46fed8a/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Sep 2, 2018

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.215.176.217:8877/7c259a2bca89e2b/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Sep 2, 2018

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/17904e3f46fed8a/output.txt

Total script time: 19.41 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Sep 2, 2018

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/7c259a2bca89e2b/output.txt

Total script time: 24.58 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@timvandermeij timvandermeij merged commit d409c42 into mozilla:master Sep 2, 2018
@timvandermeij
Copy link
Contributor

I have enough confidence in this solution because it doesn't modify the normal behavior (no test failures), is well documented in the comments with a reference to the original issue and is easy in terms of code. Thank you for helping out with this!

@photopea
Copy link

photopea commented Sep 2, 2018

I have a related question. I want to let users extract JPG out of a PDF file. Is it possible to build the "isSourcePDF" parameter into a binary JPG, without having to decompress it and compress it again? Maybe just change a few bytes in some metadata?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants