https://github.com/3ee-games/image-tools
Imaging tools CLI for preprocessing datasets before model training.
https://github.com/3ee-games/image-tools
ai-art artificial-intelligence dreambooth generative-art hypernetwork image image-chunker image-downloader image-processing image-scraper img2img linux macos python stable-diffusion textual-inversion txt2img windows
Last synced: about 2 months ago
JSON representation
Imaging tools CLI for preprocessing datasets before model training.
- Host: GitHub
- URL: https://github.com/3ee-games/image-tools
- Owner: 3ee-Games
- License: mit
- Created: 2022-12-14T20:52:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-09T22:08:42.000Z (over 2 years ago)
- Last Synced: 2025-04-06T16:07:41.442Z (2 months ago)
- Topics: ai-art, artificial-intelligence, dreambooth, generative-art, hypernetwork, image, image-chunker, image-downloader, image-processing, image-scraper, img2img, linux, macos, python, stable-diffusion, textual-inversion, txt2img, windows
- Language: Python
- Homepage:
- Size: 1.68 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Image Tools CLI đŧī¸
[](https://badge.fury.io/py/imgtools-cli)
[](https://pepy.tech/project/imgtools-cli)
[](https://pepy.tech/project/imgtools-cli)
[](https://pepy.tech/project/imgtools-cli)Command line interface for pre-processing images for model training.
## Features
- Download all images from a url
- Convert images to PNG
- Resize and crop images
- Chunk large images into smaller squares
- Remove images with more than one person
## Installation
create a virtual environment and imgtools-cli through pip:
```bash
python3 -m venv venv
source venv/bin/activate
pip install imgtools-cli
```## Usage
### âšī¸ Help
```bash
python -m imgtools_cli -h
```### âŦ Download all images from a website
```-D {url}, {output directory}```
```bash
python -m imgtools_cli -D https://www.gutenberg.org/cache/epub/67098/pg67098-images.html /Users/ootie/images
```### ⨠Convert images to PNG files
```-I {input directory}```
```bash
python -m imgtools_cli -I /Users/ootie/image_files
```### âī¸ Resize / Crop images
```-r {input directory}, {width}, {height}, {crop_focal_point}, {dnn_model_path}```
Using crop focal point:
```bash
python -m imgtools_cli -r /Users/ootie/images 512 512 True None
```Passing in a haar xml to focal crop faces:
```bash
python -m imgtools_cli -r /Users/ootie/images 512 512 True /Users/ootie/models/haarcascade_frontalface_default.xml
```### â Chunk large images into squares
Easily take large images and split them into smaller squares for training.
_Example:_ You may want to train on this image but need to split it into smaller squares for training.
Put it through the chunker and you get this:
| chunk 1 | chunk 2 | chunk 3 | | |
|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|---|---|
|  |  |  | | |```-C {dimensions}, {input_directory}, {output_directory}```
```bash
python -m imgtools_cli -C 512 /Users/ootie/input /Users/ootie/output
```### đĢ Hassan People Remover
Uses face detection to remove images with more than one person. Helpful for cleaning source images to be used for Stable Diffusion training.
_Example:_ If your input images have more than one person, the image will be deleted:

Sample images to test with: https://github.com/hassan-sd/people-remover/tree/main/images
```-R {input_directory}, {path_to_cascade_xml}```
```bash
python -m imgtools_cli -R /Users/ootie/image-tools/images/ /Users/ootie/image-tools/examples/haarcascade_frontalface_default.xml
```Ported from: https://github.com/hassan-sd/people-remover