sd-forge-layerdiffuse icon indicating copy to clipboard operation
sd-forge-layerdiffuse copied to clipboard

Transparent image infotext + saving support

Open catboxanon opened this issue 4 months ago β€’ 8 comments

Title. Transparent images are currently passed to the UI as a uint8 array where Gradio handles it. This properly adds infotext to the image and also adds the option for a user to save these images (in addition to the checkered-patterned image currently saved).

catboxanon avatar Mar 01 '24 19:03 catboxanon

Works! πŸ˜ŠπŸ‘

It would be helpful if the checkbox were ticked by default. It took me some time to realize I needed to search for it in the settings. Since the transparent image variant is the one primarily used, I don't see value in saving only the checkerboard version anyway. Enabling the transparent image option by default seems like a sensible choice to me. What do you think?

EtienneDosSantos avatar Mar 02 '24 14:03 EtienneDosSantos

has some weird blurry efffect if save format is set to webp, any ideas?

Save as PNG

00066-2024-03-04 01-11-58-transparent

Save as WEBP (and converted to PNG for uploading to GitHub)

00064-2024-03-04 01-11-14-transparent

SLAPaper avatar Mar 03 '24 17:03 SLAPaper

WebP currently has the alpha channel stripped. That would need to be fixed upstream.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/c8a5322d1f97a429e3ddc87a0feb44128b900bbd/modules/images.py#L553-L555

catboxanon avatar Mar 03 '24 18:03 catboxanon

Can confirm this commit works to fix the saving issue where the transparent png isn't also saved in the output folder. With this one, both are saved in the output dir, even if it's an external dir.

magejosh avatar Mar 05 '24 08:03 magejosh

An option to not save the "checkerboard" preview would be appreciated. This is useless content to output except for a preview purpose, I don't think it should be saved at all personally, but if someone has a use for it, an option would be alright.

MNeMoNiCuZ avatar Mar 06 '24 14:03 MNeMoNiCuZ

I haven't done any testing to verify but my guess is the checkerboard background is the one returned by default for compatibility reasons. Most webui code and extensions will strip out the alpha channel if one is found. The transparent image being passed into extra_result_images theoretically prevents any further processing being done to it.

Waiting to make any changes to this PR until lllyasviel has a chance to review it.

catboxanon avatar Mar 06 '24 17:03 catboxanon

During batch generation when the '*-transparent.png' copy is saved, it has the incorrect seed in the info text.

guilloware avatar Mar 08 '24 08:03 guilloware

como la puedo usar?

yosoyimaginacion avatar Mar 11 '24 03:03 yosoyimaginacion

Thanks for this work ! γƒΎ(β—Β°βˆ‡Β°β—)οΎ‰οΎž Can someone please describe in detail the steps to resolve the issue? As a user with no programming foundation, how should I operate? (I tried replacing the .py file with the same name, and although the checkbox appeared, the image generated by layerdiffuse became with a solid black background.Still not saving transparent image successfully)

LiXiuping avatar Apr 01 '24 12:04 LiXiuping

Closing in favor of https://github.com/layerdiffusion/sd-forge-layerdiffuse/pull/99 which more fully encompasses these issues.

catboxanon avatar Apr 23 '24 21:04 catboxanon