Skip to content

Save all MODES as all SAVE formats#9447

Open
CTimmerman wants to merge 1 commit intopython-pillow:mainfrom
CTimmerman:main
Open

Save all MODES as all SAVE formats#9447
CTimmerman wants to merge 1 commit intopython-pillow:mainfrom
CTimmerman:main

Conversation

@CTimmerman
Copy link
Contributor

@CTimmerman CTimmerman commented Feb 23, 2026

Fixes #2663
Fixes #9428

Changes proposed in this pull request:

  • Save all MODES as all SAVE formats.
  • Accept extensions in format for unnamed file object saving of mode L in BW etc.
  • Document name feature of file pointer if user still prefers to not use the format parameter for nameless file objects.

@CTimmerman CTimmerman force-pushed the main branch 4 times, most recently from e7ef6c7 to f8eb039 Compare February 23, 2026 01:22
@CTimmerman CTimmerman marked this pull request as draft February 23, 2026 01:25
@CTimmerman CTimmerman changed the title Save all MODES except La and LAB as all 53 SAVE formats Save all MODES as all SAVE formats Feb 23, 2026
@CTimmerman CTimmerman force-pushed the main branch 11 times, most recently from 0be9ef1 to bff2850 Compare February 25, 2026 22:15
@CTimmerman CTimmerman marked this pull request as ready for review February 26, 2026 10:38
@CTimmerman
Copy link
Contributor Author

CTimmerman commented Feb 26, 2026

I don't know why only amazon-2-amd64 failed to load the jpeg2k plugin, but that might relate to #9432.

Also, mode CMYK fails to save in Jpeg2k plugin, but only on the Ubuntu test machines, so on sys.platform "linux" i also convert CMYK to RGBA when saving JPEG2000.

@radarhere
Copy link
Member

radarhere commented Feb 26, 2026

I don't know why only amazon-2-amd64 failed to load the jpeg2k plugin

It would be because OpenJPEG is not installed - https://github.com/python-pillow/Pillow/actions/runs/22418319033/job/64909670542?pr=9447#step:6:694

External libraries are not always installed by users in the real world either, and tests should accommodate this by avoiding checking that functionality with something like

if ext == ".jp2" and not features.check_codec("jpg_2000"):

or
@skip_unless_feature("webp")

@CTimmerman CTimmerman force-pushed the main branch 2 times, most recently from c2f1ac9 to 9b5e8d6 Compare February 26, 2026 12:21
@CTimmerman
Copy link
Contributor Author

CTimmerman commented Feb 26, 2026

Thanks for the touch up. I assume since the modebase uses the same color space as the mode, it doesn't need the dither argument? checks implementation Nope, that only returns L or RGB so should get dithered as well.

@CTimmerman CTimmerman force-pushed the main branch 2 times, most recently from d2a45d5 to 647dd2f Compare February 26, 2026 15:46
Document name feature of file pointer
@CTimmerman
Copy link
Contributor Author

That one fail is a pipeline glitch.

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.

Can't save all extensions to BytesIO Convert image to supported mode before saving

2 participants