Skip to content

Implement Image.split() and Image.getbands() - #15

Merged
bgunebakan merged 3 commits into
mainfrom
14-implement-imagesplit-and-imagegetbands
May 25, 2026
Merged

Implement Image.split() and Image.getbands()#15
bgunebakan merged 3 commits into
mainfrom
14-implement-imagesplit-and-imagegetbands

Conversation

@bgunebakan

@bgunebakan bgunebakan commented May 24, 2026

Copy link
Copy Markdown
Owner

What is solved?

Implements Image.split() and Image.getbands() on the Image class, closing #14. Both methods are Pillow-compatible and cover all currently supported image modes (L, LA, RGB, RGBA). Also fixes a gap in Image.new(): it now correctly accepts a 2-tuple (luma, alpha) color value when creating LA-mode images.

Changes

  • Image.split() splits an image into its individual channels and returns a tuple[Image, ...] of independent L-mode (grayscale) copies, one per band. Splitting a single-band L image returns a 1-tuple copy.
  • Image.getbands() returns a tuple[str, ...] of band name strings for the image's mode (e.g. ('R', 'G', 'B') for RGB).

Bug fix

  • Image.new() now accepts a (luma, alpha) 2-tuple color for LA-mode images (color parsing extended in utils.rs).

Checklist

@bgunebakan bgunebakan self-assigned this May 24, 2026
@bgunebakan bgunebakan added the enhancement New feature or request label May 24, 2026
@bgunebakan bgunebakan linked an issue May 24, 2026 that may be closed by this pull request
@bgunebakan bgunebakan changed the title 14 implement imagesplit and imagegetbands Implement Image.split() and Image.getbands() May 25, 2026
@bgunebakan
bgunebakan merged commit 4fe349b into main May 25, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement Image.split() and Image.getbands()

1 participant