stable-diffusion-webui-images-browser icon indicating copy to clipboard operation
stable-diffusion-webui-images-browser copied to clipboard

[feature request] search ALL of image metadata?

Open createperhaps opened this issue 2 years ago • 13 comments

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?

createperhaps avatar Dec 07 '22 16:12 createperhaps

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

ghost avatar Dec 28 '22 15:12 ghost

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?

createperhaps avatar Dec 28 '22 15:12 createperhaps

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

ghost avatar Dec 28 '22 15:12 ghost

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.

createperhaps avatar Dec 28 '22 15:12 createperhaps

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.

ghost avatar Dec 28 '22 15:12 ghost

Right, okay. image Does this help me?

createperhaps avatar Dec 28 '22 15:12 createperhaps

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

ghost avatar Dec 28 '22 15:12 ghost

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

createperhaps avatar Dec 28 '22 15:12 createperhaps

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

ghost avatar Dec 28 '22 16:12 ghost

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 avatar Dec 28 '22 19:12 createperhaps

@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

createperhaps avatar Dec 29 '22 01:12 createperhaps

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

  • https://github.com/python-pillow/Pillow/issues/5076
  • https://github.com/python-pillow/Pillow/pull/5144

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.

ghost avatar Dec 29 '22 09:12 ghost

Yah i could understand how the pr of using ai to make an ai script could go. Are you able to handle the gui? I struggled as is.

Id be happy to send you a few images with the adobe metadata for testing if you don’t have adobe.

I ran out of time on colab yesterday but searching “5” for a 5 star rating brought up every image with a 5 in the file name. I suspect that if I searched “rating=5” it would filter better. Don’t think that’s an issue though.

Given not every user will use adobe (but I know there are more people who do further edit in adobe) would it make sense to put an option in the settings to turn it on?

Just to give you context on why I’m rating and colour labeling, red means generation issue like weird hand or eye, and that I need to run it through img 2 img. This will help me filter by red in automatic111 itself, so I can bring up the reds then go through img2img. I wish I could rate the images in auto rather than just favourite, but thought using adobes built in meta may be easier and make more sense.

On Thu, Dec 29, 2022 at 4:25 AM AnonPrompts @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/yfszzx/stable-diffusion-webui-images-browser/issues/58#issuecomment-1367183582, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4TQTDA3M2H3APOTOYXE3FDWPVKHNANCNFSM6AAAAAASXBDM3Q . You are receiving this because you authored the thread.Message ID: @.*** com>

createperhaps avatar Dec 29 '22 12:12 createperhaps