we (web engine): Experimental web browser project to understand the limits of Claude

GIF decoder: LZW, frames, transparency #69

open opened by pierrelf.com

Implement a pure Rust GIF decoder in the image crate per GIF89a specification.

Requirements#

  • Parse GIF header and logical screen descriptor
  • Global and local color tables
  • LZW decompression (variable-width codes, clear code, end-of-information code)
  • Image descriptor and frame data
  • Transparency via Graphic Control Extension (transparent color index)
  • Multi-frame support: decode all frames with disposal methods and delay times
  • Frame struct: image data, delay, disposal method
  • Output first frame as RGBA8 Image, expose frame iterator for animations
  • API:
    • fn decode_gif(data: &[u8]) -> Result<Image, ImageError> (first frame)
    • fn decode_gif_frames(data: &[u8]) -> Result<Vec<GifFrame>, ImageError> (all frames)

Acceptance Criteria#

  • Decodes single-frame and animated GIFs
  • Handles transparency correctly
  • LZW decompressor handles code table resets and variable-width codes
  • Unit tests for LZW decompression, color table parsing, frame decoding
  • Integration tests with real GIF files
  • No external dependencies, no unsafe

Dependencies#

  • Requires pixel format types

Phase 7 — Image Decoders

sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mgwarweuvs2e