Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
GThumb Scripts

GThumb Scripts

I love GThumb, listed here are a couple scripts I use with GThumb.

### Copy Stable Diffusion image prompt to clipboard
# The "Parameters" EXIF tag is based on Automatic1111's web UI
# Note that this script just copies the prompt, not the whole config.
# The whole config can be copied by replacing the last "paramStr" with "exifStr"
# Dependencies:
# exiftool: sudo apt install exiftool
exifStr=$(exiftool -Parameters %F) && paramStr=$(echo "$exifStr" | sed -n 's/.*:\ \(.*\)Negative prompt.*/\1/p') && echo "$paramStr" | xclip -selection clipboard
### Remove image background
# This creates a new image with the background removed. The new file will have a "-nobg" appended to the filename.
# Dependencies
# rembg:
# rembg is installed with PIP. Mine is in a conda env, GThumb was throwing an error unless I gave it the full path
# if rembg doesn't work by itself doesn't work, run `whereis rembg` in the CLI to get its path.
/home/chris/anaconda3/bin/rembg i %F %Q{ %P/%N-nobg%E }
### View (all) EXIF data
# GThumb natively supports showing EXIF data; however, it struggles with non-standard EXIF data.
# This script uses "exiftool" to show all EXIF data in a YAD popup window.
# Dependencies:
# yad: sudo apt install yad
# exiftool: sudo apt install exiftool
exiftool %F | yad --text-info --title="exiftool: %B" --fontname="Monospace 10" --width=600 --height=800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment