Skip to content

Nenotriple/img-txt_viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icon img-txt Viewer

Display an image and text file side-by-side for easy manual captioning or tagging. +Tons of features to help you work faster!

  cover

📝 Usage

  • Prepare Your Files:
    • If you choose to include a text pair for an image, ensure they share the same basenames.
    • For example: 01.png and 01.txt, 02.jpg and 02.txt, etc.
    • Supported image types: .png .jpg .jpeg .jfif .jpg_large .webp .bmp .gif

Images and text files can be loaded from different folder paths. Expand the section below to learn more.

Selecting an alternate text path:

By default, text files are loaded from the chosen path. To load text files from a different path, first select a directory as usual, then right-click the Browse... button and select Set Text File Path. An indicator to the left of the Directory entry will turn blue when a different path is chosen, and hovering the mouse over the indicator will display the selected text path.

  • Example folder structures:
.
└── dataset/
    ├── 01.png
    ├── 01.txt
    ├── 02.jpg
    └── 02.txt

(Images and text files in same folder)

.
└── dataset/
    ├── images/
    │   ├── 01.png
    │   └── 02.jpg
    └── captions/
        ├── 01.txt
        └── 02.txt

(Images and text files in separate folder)

💡 Tips and Features

  • 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 quickly delete it.
  • Tips:

    • Highlight matching words by selecting text.
    • Enable List View to display text in a vertical list format.
    • Quickly create text pairs by loading the image and saving the text.
    • Get Autocomplete Suggestions while you type using Danbooru/Anime tags, the English Dictionary, etc.
    • Fuzzy Search Use an asterisk * while typing to return a broader range of suggestions.
      • For example: Typing *lo*b returns "looking back", and even "yellow background"
  • Text Tools:

    • Batch tag Delete: View all tag in a directory as a list, and quickly delete them. (Stand alone tool)
    • Prefix Text Files: Insert text at the START of all text files.
    • Append Text Files: Insert text at the END of all text files.
    • Search and Replace: Edit all text files at once.
    • Filter Pairs: Filter pairs based on matching text, blank or missing txt files, and more.
    • Active Highlights: Always highlight specific text.
    • My Tags: Quickly add you own tags to be used as autocomplete suggestions.
    • Cleanup Text: Fix simple typos in all text files of the selected folder.
  • Other Tools

    • Batch Resize Images: Resize a folder of images using several methods and conditions. (Stand alone tool)
    • Resize Image: Resize a single image.
    • Batch Crop Images: Crop a folder of images to an exact size, resizing if needed.
    • Crop Image: Quickly crop an image to a square or freeform ratio.
    • Upscale Image: Upscale an image using realesrgan-ncnn-vulkan
    • Expand Current Image: Expand an image to a square ratio instead of cropping.
    • Find Duplicate Files: Find and separate any duplicate files in a folder (Stand alone tool)
    • Rename and Convert Pairs: Automatically rename and convert files using a neat and tidy formatting.
  • Auto-Save

    • Check the auto-save box to save text when navigating between img/txt pairs or closing the window, etc.
    • Text is cleaned when saved, so you can ignore typos such as duplicate tokens, multiple spaces or commas, missing spaces, and more.
    • Clean text on save Can be disabled from the options menu.

Please see the ✨Tools section of the wiki for a more comprehensive breakdown of the various features.

🚩 Requirements

Tip

You don't need to worry about any requirements if using the portable/executable version.

Python 3.10+

You will need Pillow and NumPy.

  • To install Pillow: pip install pillow
  • To install NumPy: pip install numpy

Or use the included requirements.txt when setting up your venv.

📜 Version History

v1.93 changes:

Click here to view release notes!
  • New:
    • New autocomplete matching modes: Match Whole String, and Match Last Word 732120e
      • Match Whole String, This option works exactly as before. All characters in the selected tag are considered for matching.
      • Match Last Word, This option will only match (and replace) the last word typed. This allows you to use autocomplete with natural sentences. You can type using an underscore as a space to join words together.
    • New option for image grid view: Auto-Close, Unchecking this option allows you to keep the image grid open after making a selection. 67593f4
    • New Tool: Rename img-txt pairs, Use this to clean-up the filenames of your dataset without converting the image types. 8f24a7e
    • You can now choose the crop anchor point when using Batch Crop Images. 9d247ea

  • Fixed:
    • Fixed issue where Autocomplete was broken from the executable version.
    • Fixed an issue where initially loading a directory could result in the first text file displayed being erased. ae56143

  • Other changes:
    • Improved performance of Autocomplete, by handling similar names more efficiently. Up to 40% faster than before. d8be0f2
    • Improved performance when viewing animated GIFs by first resizing all frames to the required size and caching them. c8bd32a
    • Improved efficiency of TkToolTip by reusing tooltip widgets, adding visibility checks, and reducing unnecessary method calls. 8b6c0dc
    • Slightly faster image loading by using PIL's thumbnail function to reduce aspect ratio calculation. 921b4d3