Open joefaron opened 2 years ago
Nvm I'll just make a log file with filename->prompt, etc.
png's dont support exif metadata either: https://photo.stackexchange.com/questions/75715/how-to-add-author-and-other-properties-to-png-files
Added in code below def main(): in img2img.py
logger = logging.getLogger() handler = logging.FileHandler('log-prompts.html') logger.addHandler(handler)
then after it .save()'s the png:
logger.error("<img src='"+str(img_name)+"'><BR>prompt="+ str(opt.prompt) + "<BR>strength="+str(opt.strength)+"<BR> init_img="+str(opt.init_img)+"<BR><HR>")
Then all I do is refresh the html file and see a history of everything..
FYI the prompt is in the PNG, in an attr called Dream
(at least it is when I use dream.py
on a Mac) There is also a dream_log.txt
file created with all the prompts.
The tool exiftool
can read/write these attrs:
# Bash snippet, assuming $f is the filename of the png
# Extract the Dream attr which is "prompt blah" -s20 -W512 -H512 -C7.5 -Ak_euler -S1234
dream=$(/usr/local/bin/exiftool -s3 -Dream "$f")
# Subject will be everything inside the quotes. Displayed in Finder Inspector as Keywords, delimited by a comma
# Put the Dream attr into Description (which is displayed in Finder Inspector)
subj=$(echo $dream | cut -f2 -d'"')
/usr/local/bin/exiftool -overwrite_original -sep "," -Subject="$subj" -Description="$dream" "$f"
Would be nice to see the prompt in the metadata of the images..? I'm not great with python, seems easy: https://stackoverflow.com/questions/58399070/how-do-i-save-custom-information-to-a-png-image-file-in-python
Super fun to play around, but I'm already forgetting which prompts I used in images I've preferred.. thinking about doing an AI art level for my game Fish Wrangler, as I've already got an eldritch and HP lovecraft level.. ;)