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

[IMAGING-355] Add option to skip reading GIF metadata #301

Merged
merged 5 commits into from
Dec 23, 2023

Conversation

andrewmkhoury
Copy link
Contributor

@andrewmkhoury andrewmkhoury commented Jul 8, 2023

IMAGING-355 - Large animated GIF takes too much heap memory in getMetadata

@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (a586021) 70.82% compared to head (c0c9846) 71.45%.
Report is 197 commits behind head on master.

Files Patch % Lines
...he/commons/imaging/formats/gif/GifImageParser.java 33.33% 2 Missing and 2 partials ⚠️
...mons/imaging/formats/gif/GifImagingParameters.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #301      +/-   ##
============================================
+ Coverage     70.82%   71.45%   +0.63%     
- Complexity     3405     3569     +164     
============================================
  Files           333      352      +19     
  Lines         16834    17375     +541     
  Branches       2588     2694     +106     
============================================
+ Hits          11922    12415     +493     
- Misses         3897     3906       +9     
- Partials       1015     1054      +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…adata

* Add stopReadingBeforeImageData to GifImageParameters
* Add unit test for IMAGING-355
@andrewmkhoury
Copy link
Contributor Author

andrewmkhoury commented Aug 9, 2023

@garydgregory and @kinow I implemented the changes per your request. However, I am not sure how much value passing stopReadinngBeforeImageData via GifImageParameters adds.
Regarding the unit tests, getImageInfo already has a unit test and I added a test for getMetadata.

  • Add stopReadingBeforeImageData to GifImageParameters
  • Add unit test for IMAGING-355

@@ -407,7 +407,11 @@ public byte[] getIccProfileBytes(final ByteSource byteSource, final GifImagingPa
@Override
public ImageInfo getImageInfo(final ByteSource byteSource, final GifImagingParameters params)
throws ImagingException, IOException {
final GifImageContents blocks = readFile(byteSource, false);
boolean stopReadingBeforeImageData = true;
Copy link
Member

@garydgregory garydgregory Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've changed the default behavior here which makes the parameter a forced usage, which might be a surprise, I'll flip it post mege.

@garydgregory garydgregory changed the title IMAGING-355 - Large animated GIF takes too much heap memory in getMetadata [IMAGING-355] Large animated GIF takes too much heap memory in getMetadata Dec 23, 2023
@garydgregory garydgregory merged commit 888d6fa into apache:master Dec 23, 2023
15 checks passed
@garydgregory garydgregory changed the title [IMAGING-355] Large animated GIF takes too much heap memory in getMetadata [IMAGING-355] Add option to skip reading GIF metadata Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants