Skip to content

feat: add PNG/JPEG image support and text wrapping with justification#9

Open
dewie wants to merge 1 commit intocode-supply:mainfrom
dewie:pr-clean-image-text-wrapping
Open

feat: add PNG/JPEG image support and text wrapping with justification#9
dewie wants to merge 1 commit intocode-supply:mainfrom
dewie:pr-clean-image-text-wrapping

Conversation

@dewie
Copy link

@dewie dewie commented Mar 10, 2026

Add comprehensive image format support:

  • PNG images with full transparency support (indexed, grayscale-alpha, RGBA/GA)
  • PNG filter algorithms (None, Sub, Up, Average, Paeth) for proper decompression
  • JPEG images with CMYK color space handling
  • Automatic format detection via magic bytes

Add text wrapping functionality:

  • Automatic text wrapping with configurable max_width
  • Multiple justification modes (left, right, center, fully justified)
  • Word breaking and hyphenation support
  • Font metrics-based width calculations

Implementation details:

  • New modules: Mudbrick.Images.Png, Mudbrick.Images.Jpeg, Mudbrick.TextWrapper
  • Updated Mudbrick.Image with format detection and delegation
  • Extended Mudbrick.text/3 API with wrapping options
  • Comprehensive test coverage with fixtures for all formats

All tests passing (124 tests, 0 failures)

Add comprehensive image format support:
- PNG images with full transparency support (indexed, grayscale-alpha, RGBA/GA)
- PNG filter algorithms (None, Sub, Up, Average, Paeth) for proper decompression
- JPEG images with CMYK color space handling
- Automatic format detection via magic bytes

Add text wrapping functionality:
- Automatic text wrapping with configurable max_width
- Multiple justification modes (left, right, center, fully justified)
- Word breaking and hyphenation support
- Font metrics-based width calculations

Implementation details:
- New modules: Mudbrick.Images.Png, Mudbrick.Images.Jpeg, Mudbrick.TextWrapper
- Updated Mudbrick.Image with format detection and delegation
- Extended Mudbrick.text/3 API with wrapping options
- Comprehensive test coverage with fixtures for all formats

All tests passing (124 tests, 0 failures)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant