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

Transparent image infotext + saving support #6

Closed
wants to merge 1 commit into from

Conversation

catboxanon
Copy link

@catboxanon catboxanon commented Mar 1, 2024

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).

@IndigoDosSantos
Copy link

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?

@SLAPaper
Copy link

SLAPaper commented Mar 3, 2024

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

@catboxanon
Copy link
Author

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

basename="",
seed=p.seeds[i],
prompt=p.prompts[i],
extension=getattr(opts, 'samples_format', 'png'),
Copy link

Choose a reason for hiding this comment

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

then here should ignore samples_format and fix to png I supposed?
since webp has bug and jpeg has no transparent, so only png?

@magejosh
Copy link

magejosh commented Mar 5, 2024

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.

@MNeMoNiCuZ
Copy link

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.

@catboxanon
Copy link
Author

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.

@guilloware
Copy link

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

@yosoyimaginacion
Copy link

como la puedo usar?

@LiXiuping
Copy link

LiXiuping commented Apr 1, 2024

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)

@catboxanon
Copy link
Author

catboxanon commented Apr 23, 2024

Closing in favor of #99 which more fully encompasses these issues.

@catboxanon catboxanon closed this Apr 23, 2024
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

8 participants