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

[feature request] search ALL of image metadata? #58

Open
createperhaps opened this issue Dec 7, 2022 · 13 comments
Open

[feature request] search ALL of image metadata? #58

createperhaps opened this issue Dec 7, 2022 · 13 comments

Comments

@createperhaps
Copy link

createperhaps commented Dec 7, 2022

How hard would it be to expand the search to look in all of an images meta data? For example, if I rated an image 1-5 in an adobe or capture one product (or colour coded it red, blue, green, etc). I am looking around in the javascript code myself but I am unfamiliar with the code and might take me a bit to orient myself with it.
There is a search bar in the viewer that searches parameters, but I'd like it to search other chunks too. Is this doable?

@ghost
Copy link

ghost commented Dec 28, 2022

You might be interested in this which allows for searching of the full prompt text. You could modify it to check against other exif data as needed.

if img.info is not None and img.info["parameters"] is not None:

https://github.com/yfszzx/stable-diffusion-webui-images-browser/pull/66/files

@createperhaps
Copy link
Author

Not overly familiar with python, but I can try. Should I need to reload SD every time I edit the script, like does it have a cache, or can I keep uploading to google drive and trying?

@ghost
Copy link

ghost commented Dec 28, 2022

If you click Apply and restart UI under the extensions tab it'll reload any code changes you make.

@createperhaps
Copy link
Author

Thanks. Does this script do what I want, and its just not merged, or do I need to modify the script? I see references to all_metadata.

@ghost
Copy link

ghost commented Dec 28, 2022

It probably doesn't do what you want. This checks for the "parameters" exif data which is where the prompt info is stored. I'm not sure where adobe ratings would be stored but it'll likely be somewhere under img.info["XXXX"]. You'll need to figure out what the XXXX should be for your use case or loop through every entry in img.info[] and do a string comparison against every single one.

@createperhaps
Copy link
Author

Right, okay.
image
Does this help me?

@ghost
Copy link

ghost commented Dec 28, 2022

Probably, yea. You'll have to play around with the img object to see where you can pull this information from but it sounds like the right direction.

See this post for more info https://stackoverflow.com/questions/21697645/how-to-extract-metadata-from-an-image-using-python

@createperhaps
Copy link
Author

createperhaps commented Dec 28, 2022

Thanks. Another stupid question, should print(whatever) send info and variables to google collab? or would it go to chrome console?

@ghost
Copy link

ghost commented Dec 28, 2022

Probably google collab, but I'm not familiar with google collab as I use stable diffusion locally.

@createperhaps
Copy link
Author

createperhaps commented Dec 28, 2022

I can't figure out how to output print/log to either collab or to chrome, so I can't see if I am getting the right data or not. I saw gradio has something called CSVLogger but I can't get it to work. Thanks for the suggestion but I might just need to wait to see if anyone more knowledgeable can implement this.

@createperhaps
Copy link
Author

createperhaps commented Dec 29, 2022

@AnonPrompts, I used ChatopenAI to fix the script.

Would you be able to push this fix to your reposit, or don't want it? (I didn't mess with the GUI and make a new box)

if img.info is not None:
               adobe_metadata_text = img.info.get("XML:com.adobe.xmp", "")
           else:
               adobe_metadata_text = ""

           if all_metadata.lower() in adobe_metadata_text.lower():
               unique_fileinfos.add(fileinfo)

It goes in get_all_images

@ghost
Copy link

ghost commented Dec 29, 2022

lmao that's hilarious. Looking at this issue/PR it might be better to call img.getxmp()

The UI is already a bit bloated but I guess a xmp textbox could go side by side with the prompt, negative prompt, or settings textbox. I might see how that looks soon-ish.

@createperhaps
Copy link
Author

createperhaps commented Dec 29, 2022 via email

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

No branches or pull requests

1 participant