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.
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.
Use Image.registered_extensions() to get format specifier, as done in this PR.
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 asJPG
.There are at least three possible solutions.
jpeg
as format specifier inFooocus-API
itself.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.