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

Adding the option to save pnginfo/metadata #1631

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ExoPhantasm
Copy link

This adds the ability to add metadata via PIL pnginfo.
This is useful for storing workflow or related data directly into the .png file.

This is mainly in mind for batch operations where you might be using BLIP and you want to then store that information and reuse elsewhere, but it also gives users the option to replicate what popular Stable Diffusion UI's do when creating an image, this then allows you to send the generation parameters from Chainner over to your favourite UI's ready to be parsed, such as the HxW, pos/neg prompts, seed etc.

It should all be working as expected but if you use a non-standard metadata key some online png metadata services might omit it.

@RunDevelopment
Copy link
Member

While, I think that it's fine to support saving PNG info, I am not a fan of the current implementation. I think that it makes the Save Image node too complex.

So here is what I would suggest: The Save Image node only gets a single new input called "PNG Info". The "PNG Info" input is an optional input that takes a PIL PNGInfo object. To create those objects, we have a little helper node (fittingly) called "PNG Info". The PNG Info node will have 2 text inputs for key and value.
This design move the complexity of creating a PNGInfo object into its own node, which also allows users to reuse those objects.

If we want to fancy, we can also extend the PNG Info node to take any number of key value pairs.

What do you think?

@ExoPhantasm
Copy link
Author

While, I think that it's fine to support saving PNG info, I am not a fan of the current implementation. I think that it makes the Save Image node too complex.

So here is what I would suggest: The Save Image node only gets a single new input called "PNG Info". The "PNG Info" input is an optional input that takes a PIL PNGInfo object. To create those objects, we have a little helper node (fittingly) called "PNG Info". The PNG Info node will have 2 text inputs for key and value. This design move the complexity of creating a PNGInfo object into its own node, which also allows users to reuse those objects.

If we want to fancy, we can also extend the PNG Info node to take any number of key value pairs.

What do you think?

Okay great, that sounds like a clean solution. Originally it did have it as its own node (although not quite the same) but I wasn't sure on the desired balance between overall node count and node complexity, so it's good to know.

I can look into updating this tomorrow as requested. I like the idea of multiple key value pairs and I think I know what is required to meet the above, but I will reach out on Discord if I am missing something.

@joeyballentine
Copy link
Member

joeyballentine commented Jun 24, 2023

@ExoPhantasm Did you ever continue working on this? It seems like it would be useful to have

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.

3 participants