Skip to content

allow pil image as input#8

Merged
Astropilot merged 3 commits intoAstropilot:mainfrom
yupbank:allow-pil-images
Dec 14, 2023
Merged

allow pil image as input#8
Astropilot merged 3 commits intoAstropilot:mainfrom
yupbank:allow-pil-images

Conversation

@yupbank
Copy link
Copy Markdown
Contributor

@yupbank yupbank commented Apr 13, 2023

No description provided.

@Astropilot
Copy link
Copy Markdown
Owner

Hello,

Thank you for your contribution!

I agree with the idea of allowing encoding of a PIL image, but rather than defining an additional function I suggest accepting an additional type in the already existing function image_to_thumbhash.
Example of implementation:

def image_to_thumbhash(
    image: Union[str, bytes, Path, BinaryIO, Image.Image],
) -> str:
    if not isinstance(image, Image.Image):
        image = Image.open(image) # For str, bytes, Path, BinaryIO we use the open() function

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

@yupbank
Copy link
Copy Markdown
Contributor Author

yupbank commented Apr 20, 2023

Is there anything blocking you from merging it cc @Astropilot ?

@Astropilot Astropilot merged commit 3466632 into Astropilot:main Dec 14, 2023
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.

2 participants