Add overloads for exif_transpose

This commit is contained in:
Marc Mueller 2025-01-02 17:38:21 +01:00
parent 66f5a3facc
commit 1678f7f215

View File

@ -22,7 +22,7 @@ import functools
import operator import operator
import re import re
from collections.abc import Sequence from collections.abc import Sequence
from typing import Protocol, cast from typing import Literal, Protocol, cast, overload
from . import ExifTags, Image, ImagePalette from . import ExifTags, Image, ImagePalette
@ -673,6 +673,16 @@ def solarize(image: Image.Image, threshold: int = 128) -> Image.Image:
return _lut(image, lut) return _lut(image, lut)
@overload
def exif_transpose(image: Image.Image, *, in_place: Literal[True]) -> None: ...
@overload
def exif_transpose(
image: Image.Image, *, in_place: Literal[False] = False
) -> Image.Image: ...
def exif_transpose(image: Image.Image, *, in_place: bool = False) -> Image.Image | None: def exif_transpose(image: Image.Image, *, in_place: bool = False) -> Image.Image | None:
""" """
If an image has an EXIF Orientation tag, other than 1, transpose the image If an image has an EXIF Orientation tag, other than 1, transpose the image