Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Merge PFM documentation into PPM#9434

Merged
hugovk merged 2 commits intopython-pillow:mainfrom
radarhere:formats
Feb 13, 2026
Merged

Merge PFM documentation into PPM#9434
hugovk merged 2 commits intopython-pillow:mainfrom
radarhere:formats

Conversation

@radarhere
Copy link
Member

Most of the headings at https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html match the format attribute, as used by open() or save().

This updates it so that they all do.

While here, I have also updated the format / id for PalmImagePlugin to be uppercase, since Image immediately transforms it anyway.

Image.register_save("Palm", _save)
Image.register_extension("Palm", ".palm")
Image.register_mime("Palm", "image/palm")

Pillow/src/PIL/Image.py

Lines 3845 to 3855 in 913698b

def register_save(
id: str, driver: Callable[[Image, IO[bytes], str | bytes], None]
) -> None:
"""
Registers an image save function. This function should not be
used in application code.
:param id: An image format identifier.
:param driver: A function to save images in this format.
"""
SAVE[id.upper()] = driver

Pillow/src/PIL/Image.py

Lines 3872 to 3880 in 913698b

def register_extension(id: str, extension: str) -> None:
"""
Registers an image extension. This function should not be
used in application code.
:param id: An image format identifier.
:param extension: An extension used for this format.
"""
EXTENSION[extension.lower()] = id.upper()

Pillow/src/PIL/Image.py

Lines 3830 to 3842 in 913698b

def register_mime(id: str, mimetype: str) -> None:
"""
Registers an image MIME type by populating ``Image.MIME``. This function
should not be used in application code.
``Image.MIME`` provides a mapping from image format identifiers to mime
formats, but :py:meth:`~PIL.ImageFile.ImageFile.get_format_mimetype` can
provide a different result for specific images.
:param id: An image format identifier.
:param mimetype: The image MIME type for this format.
"""
MIME[id.upper()] = mimetype

@hugovk
Copy link
Member

hugovk commented Feb 12, 2026

I think the "human readable" names, where available, are more, well, readable.

@radarhere
Copy link
Member Author

Does it at least make sense to combine the PFM and PPM entries? They are handled by one plugin.

@radarhere radarhere changed the title Update documentation headings to match plugin formats Merge PFM documentation into PPM Feb 12, 2026
Co-authored-by: Hugo van Kemenade <[email protected]>
@hugovk hugovk merged commit d411196 into python-pillow:main Feb 13, 2026
5 checks passed
@radarhere radarhere deleted the formats branch February 13, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants