- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Add support for XBM and XPM #4
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
base: main
Are you sure you want to change the base?
Conversation
7478215    to
    99ec83b      
    Compare
  
    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.
I think it would be fine to include the color names table as a file in this repository with a note at the top about the license. That would be simpler than requiring an external crate.
| @@ -0,0 +1,10 @@ | |||
| # Fuzzing with libfuzzer | |||
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.
Might be worth having this also reference the note in the crate README.
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.
Done (linked to the README and repeated part of the note).
        
          
                fuzz/fuzzers/fuzzer_script_xpm.rs
              
                Outdated
          
        
      | extern crate image_extras; | ||
| extern crate image; | 
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.
These lines shouldn't be needed anymore
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.
Removed; also removed the unnecessary extern crate in fuzzer_script_xbm.rs and src/xpm.rs.
| 
 Licenses are also part of the Cargo.toml metadata, for which I am not aware of a way to express that the  Also: I've made a few other minor changes to module documentation in xpm.rs, and switched BufReader to the more natural Cursor in the fuzzer scripts. Edit 2025-07-15: made a few more documentation improvements, renamed  | 
This PR adds support for decoding the X BitMap and X PixMap formats. It would resolve image-rs/image#2410, and supersede image-rs/image#2416.
I'm marking it as draft for now since the main(Edit: undrafted now that decoding hook API is set.) Please let me know if you'd be interesting in merging either of these two formats any earlier, in which case I could split off/adjust this PR as needed.imagecrate has not yet finalized a decoding hook mechanism.Notes:
no_stdin the future: the core image decoding logic usesIterator<Item = u8>, and the ImageDecoder implementations are just wrappers under/over the core to handle IO errors and pixel output. Unfortunately this is rather verbose. The only memory allocations performed in the core logic are by the XPM decoder when creating a color name table.image-extrasproject's license,MIT OR Apache-2.0.X11license, which is MIT + no advertising clause) I've put the color name table into a separate crate (x11r6colornames. I could also move it to a subfolder of theimage-extrasrepository if that is more convenient.To keep this easier to build / based on the main branch of the(Edit:imagerepository, I've included a commit that drops the use ofregister_decoding_hook, which I plan to undo once decoding hook details are merged in some fashion inimage.register_decoding_hooknow uses file extensions/signatures and is easy to use, commit removed.)Let me know if you'd like any changes, additional tests, etc. (It may take me some time to respond.)