-
-
Notifications
You must be signed in to change notification settings - Fork 888
Add support for Portable Bitmap images #1851
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
Conversation
Merge upstream changes
Codecov Report
@@ Coverage Diff @@
## master #1851 +/- ##
=======================================
- Coverage 87% 87% -1%
=======================================
Files 944 959 +15
Lines 49753 50392 +639
Branches 6165 6258 +93
=======================================
+ Hits 43575 44113 +538
- Misses 5157 5246 +89
- Partials 1021 1033 +12
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for taking the time for this! Implementation generally looks good, but it would be nice to see validation and debug output in the decoder tests. That would help us reasoning about a format we aren't familiar with.
|
@ynse01 git submodule foreach git pull origin masterEDIT. You'll need to remove the test files you added and and them to GitLFS following the submodule update. I can see 'ppm', 'pbm', 'pgm' files loaded in binary format. |
|
The test images should now be in Git LFS. I can't find why the test coverage dropped. Can it be a false positive, as it reports a delta of only -1 % ? Let me know if I need to take action on the coverage. |
@ynse01 I'm firmly convince the code coverage is hocus pocus. 9/10 times it seems to report nonsensical results. I only keep it around to be indicative and because Enterprise types love to see those kinds of metrics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few more points and this good to merge!
@JimBobSquarePants can you take a look at the shared-infrastructure module update? Is that just a syncup with latest upstream?
Prerequisites
Description
This implements the Portable Bitmap support idea I posted earlier.
This adds support for encoding and decoding of Portable Bitmap images. These are the following image types:
All of these in both Plain and Binary excoding.
These image formats fall under the PNM family of images. See The PNM format
The somewhat related PAM image format, is not implemented here.
The class structure of the code itself is largly based on the existing Tga encoder / decoder.
I could find any other reference to black-and-white pixels. So, I mapped these pixels in a L8 pixel. White is bit value 0 in Pbm, but maps to L8 value 255. Black is bit valaue 1, but maps to L8 value 0. This choice aligns these pixels better with the existing use of L8.
Test code:
I'm open for suggestion on how to improve the test coverage. Some of my struggle was with the RoundTripTest. I couldn't get the L8 pixel images to load properly. Image.Load always returns RGB pixels, which break the pixel comparison.
In PgmDecoderTest, there is an issue with differences in behavior of Magick. It treats black-and-white pixels differently. And in the same test, the RGB input images don't load in Magick, where they DO load in IrfanView, XnConvert and my code.