Add EagerlyLoadImageBytes parsing option#1280
Closed
EdwardBlair wants to merge 4 commits intoUglyToad:masterfrom
Closed
Add EagerlyLoadImageBytes parsing option#1280EdwardBlair wants to merge 4 commits intoUglyToad:masterfrom
EdwardBlair wants to merge 4 commits intoUglyToad:masterfrom
Conversation
4bc5f0a to
77b7248
Compare
02daebc to
f30a16d
Compare
Author
|
See #1281 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a ParsingOptions.EagerlyLoadImageBytes flag (defaults to true so nothing changes for existing users). When set to false, image byte data is stripped during page processing but all the metadata like width, height, bounding box, color space etc is still available. This should help with the OOM issues in #1171 where large images blow up memory on low-RAM machines, it does not prevent the image bytes from being read into memory but does flag them for GC.
Also makes XObjectImage.RawMemory lazy so even with the default settings, enumerating images for metadata doesn't force the bytes to be copied around.
This is a stop gap in lieu of a larger change to lazy the stream.
Line endings were mixed so I've normalised them. I will do a separate PR to normalise them across the entire repo as required. Git should handle this transparently.
Warning
Please view this with ?w=1 otherwise you will get spammed with line ending changes
https://github.com/UglyToad/PdfPig/pull/1280/files?w=1