Skip to main content

Image Tools CLI 🖼️

PyPI version Downloads Downloads Downloads

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:

python3 -m venv venv

source venv/bin/activate

pip install imgtools-cli

Usage

ℹ️ Help

python -m imgtools_cli -h

⏬ Download all images from a website

-D {url}, {output directory}

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}

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:

python -m imgtools_cli -r /Users/ootie/images 512 512 True None

Passing in a haar xml to focal crop faces:

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

Put it through the chunker and you get this:

chunk 1 chunk 2 chunk 3
 Chunked Image Example  Chunked Image Example  Chunked Image Example

-C {dimensions}, {input_directory}, {output_directory}

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

Sample images to test with: https://github.com/hassan-sd/people-remover/tree/main/images

-R {input_directory}, {path_to_cascade_xml}

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

Metadata

Release files for imgtools-cli 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imgtools-cli 1.0.8
File Size Uploaded Provenance Actions
imgtools-cli-1.0.8.tar.gz 11.4 kB Without provenance Details for imgtools-cli-1.0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for imgtools-cli 1.0.8
File Interpreter ABI Platform Actions
imgtools_cli-1.0.8-py3-none-any.whl Python 3 none any Details for imgtools_cli-1.0.8-py3-none-any.whl

Total release size: 23.9 kB

Release files / imgtools-cli-1.0.8.tar.gz

Download URL imgtools-cli-1.0.8.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d3aa31e166c1e6f61350c83ff47c44a91cae3f68c44c7aaad4e25e3df537768b
BLAKE2b-256 checksum
How to use checksums
2e2bc71e82f216dae7f63378c869ad9ff6131ea06338b326c42cbd8e3d93f219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release files / imgtools_cli-1.0.8-py3-none-any.whl

Download URL imgtools_cli-1.0.8-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b66bdabdadab63bd309dc9b2c892eacb7667287d698978ed83a47c6981d41f2
BLAKE2b-256 checksum
How to use checksums
8dd785ece8fe92514fed1e2f27e31f1c36cbcdf4d8743a5e6cb0cbc219affba0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Security for imgtools-cli 1.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page