Skip to content

arenasys/sd-tagging-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helper GUI for manual tagging/cropping


A GUI to help with manual tagging and cropping. Written in Python/Qt5. example

Usage

Please visit the wiki for additional information and tips.

Requirements

Pillow and PyQt5

pip install pillow pyqt5==5.15.7

Workings

Operates on a workflow of: input ➜ staging ➜ output. The input is a folder of images + metadata. The staging folder will store any changes you make. And the output folder is populated on demand by packaging up the input and staging data. When loading an image it will attempt to find the prompt/metadata associated with it:

GIVEN img0000.png
LOOKS FOR img0000.txt
LOOKS FOR img0000.png.txt
LOOKS FOR img0000.png.json

A txt file is expected to contain comma seperated tags. A json file is expected to be a gallery-dl metadata file. Since all changes are made in the staging folder, the input data/images are left untouched. Meaning no data loss is possible.

There are two modes of cropping, you can freely change between them with Alt. Red indicates some changes have not been saved yet, enabling you to revert to the last save with Ctrl+Z. Changes are saved automatically when switching modes or image. Press the save button or Ctrl+S to save manually. Right click the reset button to show the option to fully reset back to the original input state.

When ready the inputs can be packaged into the output folder, various packaging options are available.

Global

Tags can be applied to every image via the global image. It can be accessed with the globe button or Ctrl+G. The epsilon ••• tag represents the unique tags of each image, so placing a tag before the epsilon will prefix all images with that tag. The output tab will show the prompt with the global tags applied.

DeepDanbooru

Assumes you have a working instance of stable-diffusion-webui with DeepDanbooru working. Press the interrogate button and select the stable-diffusion-webui folder, this will be saved for next session. An alternate layout was added for efficient tagging, switch to it with Ctrl+L

Usage

The minimal usage is to run helper.py or start.bat. The program will ask you for an input folder, which will be remembered for next time. A staging and output folder will be created in the input folder, and the output dimension will be 1024x1024. For more parameters read python helper.py --help.

Hotkeys

Alt      - Switch croping mode
Ctrl + S - Save changes
Ctrl + Z - Reset to last saved state
Ctrl + A - Auto position image. contain all mode
Ctrl + D - Auto position image. fill mode
Ctrl + E - Write current crop to out.png (for testing)
Ctrl + C - Copy prompt into clip board
Ctrl + V - Paste a prompt onto the current image, adding missing tags
Ctrl + B - Paste a prompt onto the current image, deleting the previous tags
Ctrl + L - Switch to an alternate GUI layout
Ctrl + K - Toggle tag colors
Ctrl + Q - Interrogate image via DeepDanbooru
Ctrl + R - Remove unknown tag
Ctrl + T - Sort tags by popularity
Ctrl + Y - Sort tags alphabetically
Ctrl + G - View global image

Left  - Previous image
Right - Next image
Up    - Move selected tag up OR Move selection up
Down  - Move selected tag down OR Move selection up

Enter - Delete tag OR Add tag

Tab        - Cycle between tag lists
Ctrl + Tab - Reverse cycle between tag lists

WASD  - Move image (alt crop mode)

Compiling

If you change the GUI .qml files then qml_rc.py will need to be recompiled:

pyrcc5 -o qml_rc.py qml/qml.qrc

About

A GUI to help with manual tagging and cropping

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published