Skip to content

Commit

Permalink
Merge pull request #8 from yupbank/allow-pil-images
Browse files Browse the repository at this point in the history
  • Loading branch information
Astropilot authored Dec 14, 2023
2 parents 34d3920 + 2460745 commit 3466632
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions thumbhash/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@


def image_to_thumbhash(
image: Union[str, bytes, Path, BinaryIO],
image: Union[str, bytes, Path, BinaryIO, Image.Image],
) -> str:
m_image = exif_transpose(Image.open(image)).convert("RGBA")
if not isinstance(image, Image.Image):
image = Image.open(image)

m_image = exif_transpose(image).convert("RGBA")

m_image.thumbnail((100, 100))

Expand Down

0 comments on commit 3466632

Please sign in to comment.