# Image Tools CLI 🖼️
[![PyPI version](https://badge.fury.io/py/imgtools-cli.svg)](https://badge.fury.io/py/imgtools-cli)
[![Downloads](https://pepy.tech/badge/imgtools-cli)](https://pepy.tech/project/imgtools-cli)
[![Downloads](https://pepy.tech/badge/imgtools-cli/month)](https://pepy.tech/project/imgtools-cli)
[![Downloads](https://pepy.tech/badge/imgtools-cli/week)](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.
![Chunk Images](https://github.com/3ee-Games/image-tools/blob/main/examples/long.jpg)
Put it through the chunker and you get this:
| chunk 1 | chunk 2 | chunk 3 | | |
|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|---|---|
| ![ Chunked Image Example ]( https://github.com/3ee-Games/image-tools/blob/main/examples/long_0_0.png ) | ![ Chunked Image Example ]( https://github.com/3ee-Games/image-tools/blob/main/examples/long_0_512.png ) | ![ Chunked Image Example ]( https://github.com/3ee-Games/image-tools/blob/main/examples/long_0_1024.png ) | | |
```-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:
![ Face Detection]( https://github.com/3ee-Games/image-tools/blob/main/examples/faces1.jpg )
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
Raw data
{
"_id": null,
"home_page": "https://github.com/3ee-Games/image-tools",
"name": "imgtools-cli",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "image-downloader,image-scraper,heic,hypernetwork,heic-to-png,stable-diffusion,textual-inversion,dreambooth,image-chunks,image-chunker",
"author": "3ee Games",
"author_email": "ryguy@3ee.com",
"download_url": "https://files.pythonhosted.org/packages/2e/2b/c71e82f216dae7f63378c869ad9ff6131ea06338b326c42cbd8e3d93f219/imgtools-cli-1.0.8.tar.gz",
"platform": null,
"description": "# Image Tools CLI \ud83d\uddbc\ufe0f\n \n[![PyPI version](https://badge.fury.io/py/imgtools-cli.svg)](https://badge.fury.io/py/imgtools-cli)\n[![Downloads](https://pepy.tech/badge/imgtools-cli)](https://pepy.tech/project/imgtools-cli)\n[![Downloads](https://pepy.tech/badge/imgtools-cli/month)](https://pepy.tech/project/imgtools-cli)\n[![Downloads](https://pepy.tech/badge/imgtools-cli/week)](https://pepy.tech/project/imgtools-cli)\n\nCommand line interface for pre-processing images for model training.\n\n## Features\n\n- Download all images from a url\n\n- Convert images to PNG\n\n- Resize and crop images\n\n- Chunk large images into smaller squares\n\n- Remove images with more than one person\n\n\n## Installation\n\ncreate a virtual environment and imgtools-cli through pip:\n\n```bash\n\npython3 -m venv venv\n\nsource venv/bin/activate\n\npip install imgtools-cli\n```\n\n## Usage\n\n### \u2139\ufe0f Help\n\n```bash\npython -m imgtools_cli -h\n```\n\n### \u23ec Download all images from a website\n\n```-D {url}, {output directory}```\n\n```bash\npython -m imgtools_cli -D https://www.gutenberg.org/cache/epub/67098/pg67098-images.html /Users/ootie/images\n```\n\n### \u2728 Convert images to PNG files\n\n```-I {input directory}```\n\n```bash\npython -m imgtools_cli -I /Users/ootie/image_files\n```\n\n### \u2702\ufe0f Resize / Crop images\n\n```-r {input directory}, {width}, {height}, {crop_focal_point}, {dnn_model_path}```\n\nUsing crop focal point:\n\n```bash\npython -m imgtools_cli -r /Users/ootie/images 512 512 True None\n```\n\nPassing in a haar xml to focal crop faces:\n\n```bash\npython -m imgtools_cli -r /Users/ootie/images 512 512 True /Users/ootie/models/haarcascade_frontalface_default.xml\n```\n\n### \u2797 Chunk large images into squares\n\nEasily take large images and split them into smaller squares for training.\n\n_Example:_ You may want to train on this image but need to split it into smaller squares for training.\n![Chunk Images](https://github.com/3ee-Games/image-tools/blob/main/examples/long.jpg) \n\nPut it through the chunker and you get this:\n\n| chunk 1 | chunk 2 | chunk 3 | | |\n|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|---|---|\n| ![ Chunked Image Example ]( https://github.com/3ee-Games/image-tools/blob/main/examples/long_0_0.png ) | ![ Chunked Image Example ]( https://github.com/3ee-Games/image-tools/blob/main/examples/long_0_512.png ) | ![ Chunked Image Example ]( https://github.com/3ee-Games/image-tools/blob/main/examples/long_0_1024.png ) | | |\n\n\n\n```-C {dimensions}, {input_directory}, {output_directory}```\n\n```bash\npython -m imgtools_cli -C 512 /Users/ootie/input /Users/ootie/output\n```\n\n### \ud83e\udec2 Hassan People Remover\n\nUses face detection to remove images with more than one person. Helpful for cleaning source images to be used for Stable Diffusion training.\n\n_Example:_ If your input images have more than one person, the image will be deleted:\n\n![ Face Detection]( https://github.com/3ee-Games/image-tools/blob/main/examples/faces1.jpg )\n\nSample images to test with: https://github.com/hassan-sd/people-remover/tree/main/images\n\n```-R {input_directory}, {path_to_cascade_xml}```\n\n```bash\npython -m imgtools_cli -R /Users/ootie/image-tools/images/ /Users/ootie/image-tools/examples/haarcascade_frontalface_default.xml\n```\n\nPorted from: https://github.com/hassan-sd/people-remover\n",
"bugtrack_url": null,
"license": "",
"summary": "a command line interface for preparing image models",
"version": "1.0.8",
"split_keywords": [
"image-downloader",
"image-scraper",
"heic",
"hypernetwork",
"heic-to-png",
"stable-diffusion",
"textual-inversion",
"dreambooth",
"image-chunks",
"image-chunker"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8dd785ece8fe92514fed1e2f27e31f1c36cbcdf4d8743a5e6cb0cbc219affba0",
"md5": "ff2412a12430b82c830e979a19dcc9b6",
"sha256": "3b66bdabdadab63bd309dc9b2c892eacb7667287d698978ed83a47c6981d41f2"
},
"downloads": -1,
"filename": "imgtools_cli-1.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ff2412a12430b82c830e979a19dcc9b6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12466,
"upload_time": "2023-01-04T21:10:52",
"upload_time_iso_8601": "2023-01-04T21:10:52.283467Z",
"url": "https://files.pythonhosted.org/packages/8d/d7/85ece8fe92514fed1e2f27e31f1c36cbcdf4d8743a5e6cb0cbc219affba0/imgtools_cli-1.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2e2bc71e82f216dae7f63378c869ad9ff6131ea06338b326c42cbd8e3d93f219",
"md5": "5f460bf97a04baea58f0cc8c8b51d98c",
"sha256": "d3aa31e166c1e6f61350c83ff47c44a91cae3f68c44c7aaad4e25e3df537768b"
},
"downloads": -1,
"filename": "imgtools-cli-1.0.8.tar.gz",
"has_sig": false,
"md5_digest": "5f460bf97a04baea58f0cc8c8b51d98c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11439,
"upload_time": "2023-01-04T21:10:53",
"upload_time_iso_8601": "2023-01-04T21:10:53.689295Z",
"url": "https://files.pythonhosted.org/packages/2e/2b/c71e82f216dae7f63378c869ad9ff6131ea06338b326c42cbd8e3d93f219/imgtools-cli-1.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-04 21:10:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "3ee-Games",
"github_project": "image-tools",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "imgtools-cli"
}