Damselfly icon indicating copy to clipboard operation
Damselfly copied to clipboard

Possebility to show Metadata from PNG files

Open baalspawn opened this issue 1 year ago • 1 comments

Hi, I was wondering if there is a possebility to add an option to read the metadata for PNG files. This would be very nice especially for those who make Stable Diffusion images.

Both A1111 and ComfyUI store a lot of data in the Chunk section of the Metadata. Here you can retrieve prompt, model and settings used to generate the image.

So the "simple" version would be to just be able to show the meta data same way the png file inspector does. A pretty version would be more difficult due to the different ways the stable diffusions programs store their info.

Example of a simple workflow in ComfyUI: image

My current workflow when I forget how the image was made (and unable to use the workflow) is using an online PNG inspector ref: https://www.nayuki.io/page/png-file-chunk-inspector

For A1111 the following chunks are of interest: iTXt or tEXt (ref: https://www.w3.org/TR/2003/REC-PNG-20031110/#11iTXt)

For ComfyUI it is nice to have the following data: tEXt (ref: https://www.w3.org/TR/2003/REC-PNG-20031110/#11tEXt)

Not sure if the IHDR chunk is needed since Damselfly already knows the image properties. (ref: https://www.w3.org/TR/2003/REC-PNG-20031110/#11IHDR)

Eks of the chunk data:

Example from a ComfyUI with workflow attatched: SDFX_00001_ image image image The image is longer, had to cut it short ;)

Example from a Stable Diffusion Webui Forge:

Made with Stable Diffusion WebUI Forge 00000-1527653760 image

baalspawn avatar Aug 16 '24 11:08 baalspawn

Thanks, I'll take a look. I use MetadataExtractor so shouldn't have to worry about the binary data etc.

What would be useful is if you could run ExifTool over the sample images and from the output, give me the names and values of the fields you're particularly interested in. I can then look at what they're mapped to and add the code to extract them. :)

Webreaper avatar Aug 16 '24 12:08 Webreaper

Okay, I've had a look at this briefly, and added code to display the prompt in damselfly's Caption fielfd. Hope that helps.

Webreaper avatar Dec 29 '24 13:12 Webreaper