Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JPEG support #339

Merged
merged 1 commit into from
May 25, 2024
Merged

Fix JPEG support #339

merged 1 commit into from
May 25, 2024

Conversation

yak1ex
Copy link
Contributor

@yak1ex yak1ex commented May 24, 2024

Currently, at least in my environment, Fooocus-API can't write JPEG format due to errors.
This is because Pillow expects a format specifier for JPEG format as JPEG not as JPG.

There are at least three possible solutions.

  1. Use jpeg as format specifier in Fooocus-API itself.
    • I think this is the simplest solution but it would be a public API change anyway.
  2. Use Image.registered_extensions() to get format specifier, as done in this PR.
  3. Use a literal dictionary like image_format = {"png":"png", "jpg":"jpeg", "webp":"webp"}.get(extension)

This PR employs option 2. If this is not aligned with your preference, I will create another PR.

@mrhan1993 mrhan1993 merged commit d59fdc4 into mrhan1993:main May 25, 2024
@yak1ex yak1ex deleted the fix_jpeg_support branch May 25, 2024 18:56
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.

None yet

2 participants