Skip to main content

Batch process (resize, rotate, remove GPS, add border, auto do all) image files (HEIC, JPG, PNG)

Project description

batch_img

Batch processing (resize, rotate, remove GPS, add border, auto do all) image files (HEIC, JPG, PNG) by utilizing Pillow / PIL library. Resize, rotate, or add border to a single image file or all image files in a folder. Tested on macOS and Windows.

Installation

One Time Setup

One time installation of the uv tool to prepare for All future Python tools installation. Install uv tool by its standalone installers:

# On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows (PowerShell).
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

$env:Path = "C:\Users\{your_user_name}\.local\bin:$env:Path"

uv venv

.venv\Scripts\activate

Install the batch_img tool

Install the batch_img tool from PyPI:

uv pip install --upgrade batch_img

Usage

Sample command lines:

✗ batch_img --version
0.0.8

✗ batch_img rotate --angle 90 ~/Downloads/IMG_0070.HEIC
...
✅ Processed the image file(s)

Help

Top level commands help:

✗ batch_img --help
Usage: batch_img [OPTIONS] COMMAND [ARGS]...

Options:
  --update   Update the tool to the latest version.
  --version  Show the tool's version.
  --help     Show this message and exit.

Commands:
  auto    Auto process (resize to 1280, remove GPS, add border) image...
  border  Add internal border to image file(s), not expand the size.
  no-gps  Remove GPS location info in image file(s).
  resize  Resize image file(s).
  rotate  Rotate image file(s).

The auto sub-command CLI options:

✗ batch_img auto --help
Usage: batch_img auto [OPTIONS] SRC_PATH

  Auto process (resize to 1280, remove GPS, add border) image file(s).

Options:
  -ar, --auto_rotate  Auto-rotate image (experimental)
  -o, --output TEXT   Output file path. If not specified, replace the input
                      file.  [default: ""]
  --help              Show this message and exit.

The border sub-command CLI options:

✗ batch_img border --help
Usage: batch_img border [OPTIONS] SRC_PATH

  Add internal border to image file(s), not expand the size.

Options:
  -bw, --border_width INTEGER RANGE
                                  Add border to image file(s) with the
                                  border_width. 0 - no border.  [default: 5;
                                  0<=x<=30]
  -bc, --border_color TEXT        Add border to image file(s) with the
                                  border_color string.  [default: gray]
  -o, --output TEXT               Output file path. If not specified, replace
                                  the input file.  [default: ""]
  --help                          Show this message and exit.

The no-gps sub-command CLI options:

✗ batch_img no-gps --help
Usage: batch_img no-gps [OPTIONS] SRC_PATH

  Remove GPS location info in image file(s).

Options:
  -o, --output TEXT  Output file path. If not specified, replace the input
                     file.  [default: ""]
  --help             Show this message and exit.

The resize sub-command CLI options:

✗ batch_img resize --help
Usage: batch_img resize [OPTIONS] SRC_PATH

  Resize image file(s).

Options:
  -l, --length INTEGER RANGE  Resize image file(s) on original aspect ratio to
                              the length. 0 - no resize.  [default: 0; x>=0]
  -o, --output TEXT           Output file path. If not specified, replace the
                              input file.  [default: ""]
  --help                      Show this message and exit.

The rotate sub-command CLI options:

✗ batch_img rotate --help
Usage: batch_img rotate [OPTIONS] SRC_PATH

  Rotate image file(s).

Options:
  -a, --angle [0|90|180|270]  Rotate image file(s) to the clockwise angle. 0 -
                              no rotate.  [default: 0]
  -o, --output TEXT           Output file path. If not specified, replace the
                              input file.  [default: ""]
  --help                      Show this message and exit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

batch_img-0.1.8.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

batch_img-0.1.8-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file batch_img-0.1.8.tar.gz.

File metadata

  • Download URL: batch_img-0.1.8.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for batch_img-0.1.8.tar.gz
Algorithm Hash digest
SHA256 011a46d23cde2cc320a3b889aac7cecc0e3bceb5e2639a5353d74d0d201f8a8d
MD5 752ae62838f7c60ce924b92d6dcf4dcc
BLAKE2b-256 7054eab974571624eaa81ab3e126c38cc9df87d8b1ad30157cdce6ae647fd4f4

See more details on using hashes here.

File details

Details for the file batch_img-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: batch_img-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for batch_img-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9a1de729525e57b1404a366c1c6d00286fbaceedf913dd5b0d293fbcaa410fab
MD5 eb3d72cd1355f5aa230eaef8a70534ab
BLAKE2b-256 3ee20ea81a2e06d1dd560e6a46b8ab8bd2b141dc01eb76833342bcdeb0d7b520

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page