stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

return-gif

Open joindn opened this issue 2 years ago • 7 comments

Enable the returned images to support animated formats, such as GIF and WebP.

joindn avatar Nov 03 '23 07:11 joindn

Wait... isn't there a webp option on line 118 below?

AUTOMATIC1111 avatar Nov 03 '23 17:11 AUTOMATIC1111

The purpose of this PR is to enable AnimateDiff to respond a video via API. I'm not aware of any way that pillow can process mp4, so maybe we use another way - when a image is already a binary, we directly return; otherwise, process normally. I can take the responsibility of encoding it to b64 bytes.

continue-revolution avatar Nov 05 '23 05:11 continue-revolution

Well, two lines directly above added ones:

        if isinstance(image, str):
            return image

allow for exactly that.

AUTOMATIC1111 avatar Nov 05 '23 05:11 AUTOMATIC1111

Yes. Let's do it in this way.

continue-revolution avatar Nov 05 '23 06:11 continue-revolution

@AUTOMATIC1111 That two lines have not been merged to master.

Can we merge the change of api.py to master now? In this way, I don't have to patch module.api.encode_pil_to_base64.

continue-revolution avatar Nov 05 '23 06:11 continue-revolution

Well, even if this PR is merged into dev, it won't be in the master... I feel that the time for new release is not yet.

AUTOMATIC1111 avatar Nov 05 '23 07:11 AUTOMATIC1111

Thanks. I will patch encode_pil_to_base64 for the time being. I don't need this PR to support returning videos anyway.

continue-revolution avatar Nov 05 '23 07:11 continue-revolution

as we found out that there is a more general way to achieve what the author needed, this does not need to be merged; reopen the PR if there's more.

AUTOMATIC1111 avatar Jan 01 '24 13:01 AUTOMATIC1111