Skip to content
Nenotriple edited this page Oct 11, 2024 · 8 revisions

👷🏽‍♀️ Under Construction!

"Making something... Nurturing something is really great. You can see and learn so many things from the process."

🚧 ${\textsf{\color{red}The info here has not been updated for several months. Some topics may be incorrect or missing. Sorry!}}$ 🚧


img-txt_viewer comes with many tools that help ease the process of manually creating a training dataset, as well as some others that may be helpful outside of this space.

Index

✂️Shortcuts

  • ALT+LEFT/RIGHT: Quickly move between img-txt pairs.
  • SHIFT+DEL: Send the current pair to a local trash folder.
  • ALT: Cycle through auto-suggestions.
  • TAB: Insert the highlighted suggestion.
  • CTRL+S: Save the current text file.
  • CTRL+E: Jump to the next empty text file.
  • CTRL+R: Jump to a random img-txt pair.
  • CTRL+F: Highlight all duplicate words.
  • CTRL+Z / CTRL+Y: Undo/Redo.
  • F5: Refresh the text box.
  • Middle-click a tag to delete it.

📜Text Tools

  • Search and Replace: Edit all text files at once.
  • Prefix: Insert text at the START of all text files.
  • Append: Insert text at the END of all text files.
  • Filter: Filter pairs based on matching tags, blank or missing txt files, and more.
  • Highlight: Always highlight specific text when displaying tags.
  • My Tags: Quickly add your own tags to be used as autocomplete suggestions.
  • Batch Tag Delete: View all tags in a directory as a list and quickly delete them.
  • Cleanup Text: Fix common typos in all text files in the selected folder, such as duplicate tags, multiple spaces or commas, missing spaces, and more.

📷Image Tools

📦Other Tools



✂️Shortcuts

ALT+LEFT/RIGHT

With the primary text box in focus, press ALT+LEFT or ALT+RIGHT to move between img-txt pairs.

ALT+LEFT Moves back to the previous image.

ALT+RIGHT Moves forward to the next image.


SHIFT+DEL

Press SHIFT+DEL to move the displayed image and text file to a trash folder.

The trash folder is created in the selected directory.

When closing the app, you'll be asked if you want to permanently delete the trash folder.

Also available via the Tools menu and the image right-click context menu.


ALT

With the primary text box in focus, press LEFT-ALT or RIGHT-ALT to move the autocomplete selector left or right.


TAB

With the primary text box in focus, press TAB to insert the selected autocomplete tag.


CTRL+S

With the primary text box in focus, press CTRL+S to save the text to the paired text file.

'Saving' a blank text file will delete it.

Also available via the Save button.


CTRL+E

With the primary text box in focus, press CTRL+E to jump to the next empty text file from the current index position.

Also available via the index entry right-click context menu.


CTRL+R

With the primary text box in focus, press CTRL+R to jump to a random img-txt pair.

Also available via the index entry right-click context menu.


CTRL+F

With the primary text box in focus, press CTRL+F to highlight any duplicate words.

All matching words will be highlighted with the same color, but colors are randomized each time the hotkey is pressed.

This matches any duplicate string of text (minimum of 3 characters) and not just tags or words.

Example text: "this cute dog, happy doggy, small dog"

Also available via the primary text box right-click context menu.


CTRL+Z / CTRL+Y

With the primary text box in focus, press CTRL+Z to undo the last action or CTRL+Y to redo the last undo.

(Limited to keyboard and autocomplete actions)

Also available via the primary text box right-click context menu.


F5

With the primary text box in focus, press F5 to refresh the displayed text file.

It's useful when you've made edits outside the app.

Also available via the primary text box right-click context menu.


Middle-click

With the mouse over a tag in the primary text box, press the Middle-Click mouse button to delete the entire tag.

The entire comma separated value will be deleted.



📜Text Tools

Search and Replace

Use this tool to search for a string of text across all text files in the selected directory.

If a match is found, it will be replaced exactly with the given text.

Example:

Search for: the big brown dog

Replace with: the big red dog

This will replace all instances of the big brown dog with the big red dog.

  • Undo
    • When using Search and Replace, Prefix, or Append, a backup of the text files will be made and saved to the working directory before making any changes.
    • Pressing Undo will restore the text backup. Undo only creates one history of backups, and using another tool will erase the previous backup.

Prefix

Use this tool to prefix all text files in the selected directory with the entered text.

This means that the entered text will appear at the start of each text file.

  • Undo
    • When using Search and Replace, Prefix, or Append, a backup of the text files will be made and saved to the working directory before making any changes.
    • Pressing Undo will restore the text backup. Undo only creates one history of backups, and using another tool will erase the previous backup.

Append

Use this tool to append all text files in the selected directory with the entered text.

This means that the entered text will appear at the end of each text file.

  • Undo
    • When using Search and Replace, Prefix, or Append, a backup of the text files will be made and saved to the working directory before making any changes.
    • Pressing Undo will restore the text backup. Undo only creates one history of backups, and using another tool will erase the previous backup.

Filter

This tool will filter all img-txt pairs based on the provided text.

Enter any string of text to display only img-txt pairs containing that text.

Use + to include multiple strings when filtering. (Note the spaces!)

Use ! before the text to exclude any pairs containing that text.

Examples:

dog (shows only pairs containing the text dog)

!dog (removes all pairs containing the text dog)

!dog + cat (remove dog pairs, display cat pairs)


Highlight

Enter the text you want to highlight each time you move to a new img-txt pair.

Use + to highlight multiple strings of text.

Example: dog + cat


My Tags

Use this text box to quickly edit the my_tags.csv file, allowing you to easily add tags to the autocomplete dictionary.

  • Tags near the top of the list have a higher priority than lower tags.
  • Start any line with ### to create a comment.
  • Save and Refresh:
    • Save: Commit your changes to the my_tags.csv file.
    • Refresh: Refresh the loaded autocomplete dictionary with your saved changes, or refresh the text box if you've made changes outside the app.
      • Always save first, then refresh to fully commit your changes and update autocomplete.

Batch Tag Delete

Via the Tools Menu.

This stand-alone tool allows you to view all tags (comma separated values) from all text files in the selected folder.

Tags are sorted by occurrence but can also be sorted alphabetically using the Change Sort button.

Left-Click a tag to delete it from all text files.

Press Delete < to open a dialog allowing you to delete all tags with an occurrence less than or equal to the value you input.

Select multiple tags using the checkbutton to the right of a tag, then press Delete Selected to delete all selected tags.

Right-click a checkbutton to select all.

You can filter tags using the text box, tags are matched using fuzzy search.

  • Undo
    • When opening or choosing a directory, Batch Tag Delete creates backups of all text files.
    • Backups are not updated after making changes, meaning Undo All restores all changes made.

Cleanup Text

Via the Tools Menu.

This operation will clean all text files from typos like: duplicate tags, extra commas, extra spaces, trailing commas and spaces, commas without spaces, and more.

This is also performed whenever saving text and the option Cleaning Text on Save is enabled. So if you write all your tags with the app and the option enabled, it won't do anything.

Example Cleanup:

From: ,dog,solo, ,happy ,,

To: dog, solo, happy

  • Full list of cleanup operations:
    • Remove duplicate tags:
      • Input: apple apple banana banana, Output: apple banana
    • Replace a period followed by a space with a comma and a space:
      • Input: Hello. World., Output: Hello, World
    • Replace one or more spaces surrounded by optional commas with a single comma:
      • Input: Hello , World, Output: Hello,World
    • Replace multiple spaces with a single space:
      • Input: Hello World, Output: Hello World
    • Replace multiple commas with a single comma:
      • Input: Hello,,,World, Output: Hello,World
    • Replace multiple backslashes with a single backslash:
      • Input: Hello \\(World\), Output: Hello \(World\)
    • Remove removes leading and trailing commas from the end of the text:
      • Input: ,Hello,World,, Output: Hello,World
    • Remove removes leading and trailing spaces from the end of the text:
      • Input: Hello World, Output: Hello World
    • Add a space after a comma if it’s not already there:
      • Input: Hello,World, Output: Hello, World


📷Image Tools

Batch Resize Images

Via the Tools Menu.

This stand-alone tool allows you to resize all images in a folder using various methods and conditions.

Supported Filetypes: jpg, jpeg, png, webp, bmp, tif, tiff

  • Resize To:

    • Resize to Resolution: Resize to a specific width and height, ignoring aspect ratio.
    • Resize to Percentage: Resize the image by a percent scale.
    • Resize to Width: Target the image width and resize it.
    • Resize to Height: Target the image height and resize it.
    • Resize to Shorter Side: Resize the shorter side of the image.
    • Resize to Longer Side: Resize the longer side of the image.
  • Resize Condition:

    • Upscale and Downscale: Resize the image to the new dimensions, regardless of whether they're larger or smaller than the original dimensions.
    • Upscale Only: Resize the image if the new dimensions are larger than the original dimensions.
    • Downscale Only: Resize the image if the new dimensions are smaller than the original dimensions.
  • Filetype:

    • Select 'AUTO' to output with the same filetype as the input image.
    • Alternatively, choose a specific filetype (JPG, PNG, or WEBP) to force all images to be saved with the chosen type.
    • JPG and WEBP are always saved with the highest quality possible.
  • Use Output Folder:

    • If enabled, a folder Resize Output will be created, and the resized images will output there.
    • If disabled, the resized images will output to the selected directory.
  • Overwrite Files:

    • if enabled, images will be overwritten when a filename conflict occurs.
    • if disabled, conflicting files will have '_#' appended to the filename.

Resize Image

Via the Tools Menu or the image right-click context menu.

Resize the currently displayed image using an exact resolution or by a percent scale.

Lock the aspect ratio to easily edit the width or height values without squishing or stretching the image.

Unlock the aspect ratio to allow entering a value that squishes or stretches the image.

For JPG and WEBP, you can adjust the output quality from 10%, to 100%.

You can choose between the following resize methods: Lanczos, Nearest, Bicubic, Hamming, Bilinear, and Box. Lanczos is the recommended method.

As you adjust the various settings, you can see the new dimensions and image size update in real time.


Upscale Image

Via the Tools Menu or the image right-click context menu.

Upscale the currently displayed image using R-ESRGAN

  • Upscale Model:

    • realesr-animevideov3-x4 (default)
    • RealESRGAN_General_x4_v3
    • realesrgan-x4plus
    • realesrgan-x4plus-anime
  • Upscale Factor: 1x, 2x, 3x, 4x

The current size and new size are displayed in the UI after selecting an Upscale Factor.


Crop Image

Via the Tools Menu or the image right-click context menu.

Crop the currently displayed image in a pop-up window.

  • Drag with the mouse to define the area that will be cropped, and then press Space or use the Right-Click Context Menu to save the crop.
  • Click anywhere outside the crop area to clear the rectangle.
  • Double-Click to quickly create a 512x512, or 1024x1024 crop rectangle. (Automatic based on image size)
  • Enable Freeform Crop from the Right-Click Context Menu to define a non-square rectangle.
  • Each crop will have _crop## appended to the filename.
    • Saving multiple crops of the same image will increment the filename like this: _crop01, _crop02, etc.

Expand Image

Via the Tools Menu or the image right-click context menu.

Expand the currently displayed image to a square resolution without cropping.

This tool works by expanding the shorter side to a square resolution divisible by 8 and stretching the pixels around the long side to fill the space.

  • For example:
    • A portrait image would expand like this: input=||, output=| |
    • A portrait image would expand like this: input=| |, output=||

After expanding, a new image will be saved in the same format and directory as the original, with _ex appended to the filename.

This tool works great for images with solid or very smooth gradient backgrounds. It's not intended to be useful for images without simple backgrounds.



📦Other Tools

Find Duplicate Files

Via the Tools Menu.

This stand-alone tool allows you to find all duplicate files in a folder, or subfolder* and move them out for easy sorting. It works by generating and comparing a hash value for each image. You can use either MD5, or SHA-256. MD5 is faster and generally shouldn't result in false positive detections (99.9% of the time, it's fine). SHA-256 is slower but should be much more resistant to false positives.

  • Duplicate files will be moved to a _Duplicate__Files folder within the scanned directory.

  • Single or Both:

    • Single: Choosing this option will move all but one of the found duplicates to the _Duplicate__Files folder.
    • Both: Choosing this option will move all of the found duplicates to the _Duplicate__Files folder.
  • Images or All Files:

    • Images: Choosing this option will only check image files for duplicate matches, ignoring other files.
    • All Files: Choosing this option will check all files for duplicate matches.
  • Recursive*:

    • Enable this option to scan subfolders.
    • NOTE: This only compares files within the same subfolder, not across all scanned folders.
  • Set Max Scan Size:

    • Use this option to limit the maximum size of scanned files, ignoring files that are larger. (Default=2048 MB)
  • Set Filetypes to Scan:

    • Use this option to limit the scanned files to only those listed, ignoring everything else.
  • Undo

    • Using undo will restore all moved images back to their original file paths.

Rename and Convert Pairs

Via the Tools Menu.

This will rename and convert all images and text* files in the selected directory. *(Only rename text files)

Files are saved to a Renamed Output folder, nothing is overwritten.

Images are converted to JPG type (except for GIF files), and then each img-txt pair is renamed in sequential order using padded zeros to ensure 5 characters.

Example input pair: aH15520.jpg, AH15520.txt

Example output pair: 00001.jpg, 00001.txt


Clone this wiki locally