Skip to content

Add pure-Rust PNG encoding (encode_png / save_image) and 16-bit / palette PNG decoding #4

Open

Description

@voidstackloop

Summary

crates/oxideon-core/src/image_codec.rs currently provides zero-dependency pure-Rust PNG and baseline/progressive JPEG decoding (decode_png, decode_jpeg, decode_image_tensor, load_image), without leaning on Pillow.

Adding PNG encoding (encode_png, save_image) and extending decode_png to support indexed-palette (color_type = 3, PLTE chunk) and 16-bit PNGs will complete the built-in image I/O pipeline.

Relevant Files

  • crates/oxideon-core/src/image_codec.rs
  • crates/oxideon-core/tests/png_adam7.rs
  • src/python_vision.rs

Acceptance Criteria

  • Implement encode_png(pixels: &[u8], width: usize, height: usize, channels: usize) -> Result<Vec<u8>> and save_image(tensor: &Tensor, path: impl AsRef<Path>) -> Result<()>.
  • Support color_type = 3 (PLTE palette + optional tRNS) and 16-bit PNG decoding in decode_png.
  • Add round-trip tests (encode_png -> decode_png -> exact match).

Activity

  1. added
    enhancement
    help wanted
    good first issue
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions