An image captioning GUI written in PowerShell.
This is useful for captioning image datasets for text-to-image projects like Stable Diffusion.
PowerShell v7 required.
This script will generate a GUI that facilitates the fast editing of captions via a preset and toolbox system. It will display thumbnails of each image, so they can be browsed and edited very easily. The captions are stored alongside the image in a text file that shares the same name as the image.
Basic Usage:
- Run the batch file, or the script from a terminal
- Select a folder with images in it
- Choose an image to edit from the thumbnail panel
- Edit it's caption in the text box
- Add the text presets to your existing caption
- Save and mark the caption as edited
- Repeat as needed
Extra features:
-
Filtering: Underneath the thumbnail panel, there is a file filtering text box. You can filter the displayed image files by either file name, or caption content.
-
Toolbox: Underneath the text box containing the current caption's content, there is a toolbox that can perform various functions. Select the function you want from the drop down, and the appropriate controls will appear. Click the 'All Files' check box if you want to perform the action on all current files. The following functions are supported:
- Append: Appends the content of the text box to the current caption.
- Prepend: Prepends the content of the text box to the current caption.
- Replace: Replaces all instances of the content in the left text box with the content in the right text box in the current caption.
- Remove: Removes all instances of the content of the text box in the current caption.
- Regex Replace: Performs a regex match of the contents of the left text box, and replaces it with the contents of the right text box with the current caption.
- Set All Text: Sets the current caption's text to the contents of the text box.
- Clear All Text: Clears the current caption.
-
Shortcut keys:
- m: Pressing while the thumbnail panel is focussed will mark the current thumbnail as edited.
- u: Pressing while the thumbnail panel is focussed will unmark the current thumbnail as edited.
- shift + m: Pressing while the thumbnail panel is focussed with mark all current thumbnails as edited.
- shift + u: Pressing while the thumbnail panel is focussed with unmark all current thumbnails as edited.
-
Configuration:
- Presets are stored in a cfg file inside the directory you have chosen to edit your images in.
- The default preset template is stored in the cap.cfg file, you can change this to suit you own needs.