Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Expand PIL image support.#523

Merged
MarkDaoust merged 6 commits intogoogle-gemini:mainfrom
MarkDaoust:image-format
Aug 27, 2024
Merged

Expand PIL image support.#523
MarkDaoust merged 6 commits intogoogle-gemini:mainfrom
MarkDaoust:image-format

Conversation

@MarkDaoust
Copy link
Collaborator

@MarkDaoust MarkDaoust commented Aug 23, 2024

This solves most of it by basically noticing that if an image is created from a file -> turn it back to that file type.

But if it's not created from a file, is it okay to just covert to RGB, or can we do better?

Fixes:#511

Change-Id: I7303becbbd6a9441c406a28e84ecc86d2fdd35bd
@MarkDaoust MarkDaoust marked this pull request as draft August 23, 2024 18:39
@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:python sdk Issue/PR related to Python SDK labels Aug 23, 2024
Change-Id: Ibc8e091c63d30626f78510156e8c024014dddcca
Change-Id: I49b9ab206ade37a8a5535b21fa7fdf62a0c569d2
Change-Id: I813e8569b91e01a0884b1c2ff75dfa84fcf4a609
@MarkDaoust MarkDaoust changed the title fixes#511 Expand PIL image support (fixes#511) Aug 23, 2024
Change-Id: I1e4a62bb1e1fade244771027380b8a13f444885d
@MarkDaoust MarkDaoust marked this pull request as ready for review August 23, 2024 21:55
Change-Id: Ifb93c70f8ad48dce0fd0921de0e9e117819dc55c
@MarkDaoust MarkDaoust changed the title Expand PIL image support (fixes#511) Expand PIL image support. Aug 24, 2024
@MarkDaoust MarkDaoust requested a review from markmcd August 26, 2024 18:59
mime_type = "image/gif"
else:
if img.mode != "RGB":
img = img.convert('RGB')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this will upset black

markmcd
markmcd previously approved these changes Aug 27, 2024
Copy link
Member

@markmcd markmcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strategy for converting LGTM. Seems straightforward to update if we discover new corner cases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

component:python sdk Issue/PR related to Python SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants