Skip to main content

Fast multithreaded batch image processor (HEIC, JPEG, PNG, WebP, ...)

Project description

bat_img

Fast, multithreaded batch image processor — available as a standalone command-line tool installable via pip.

The binary is a native Rust executable (no Python overhead at runtime). The Python package is simply a convenient delivery mechanism so you can install bat_img the same way you install any other command-line tool.

Installation

pip install bat_img

Pre-built binaries are provided for:

Platform Architecture
macOS Apple Silicon (M1 / M2 / M3 / M4)
Linux x86-64 (glibc 2.17+, compatible with most distros)
Windows x86-64

After installation, the bat_img command is available in your terminal.

Quick start

# Strip GPS location from all iPhone photos (in-place)
bat_img -i ~/Pictures/iPhone --strip-gps

# Resize all JPEGs to 1920 px wide, save to ./web/
bat_img -i ./photos -r 1920x0 -o ./web

# Convert HEIC → WebP at quality 85, resize to 2048 px wide
bat_img -i ./iphone_photos -r 2048x0 -f webp -q 85 -o ./web

# Strip ALL metadata, auto-orient, sharpen — 8 threads, recurse
bat_img -i ./raw -R --strip-all --auto-orient --sharpen -t 8 -o ./export

Features

Feature Flag
In-place processing — overwrite originals (omit --output)
Strip GPS location from EXIF --strip-gps
Strip ALL metadata (EXIF, IPTC, XMP) --strip-all
Auto-orient from EXIF --auto-orient
Resize (width, height, or both) -r 1920x0
No-upscale guard --no-upscale
Resize filter --filter lanczos3
Add solid border --border 20 --border-color "#fff"
Rotate 90 / 180 / 270° --rotate 90
Flip horizontal / vertical --flip-h / --flip-v
Brightness adjustment --brightness 10
Contrast adjustment --contrast 15
Sharpen --sharpen
Grayscale --grayscale
Format conversion incl. HEIC -f heic / webp / png / jpeg / tiff
JPEG / WebP quality -q 85
Filename prefix / suffix --prefix web_ --suffix _sm
Parallel threads -t 8
Dry-run preview --dry-run
Recursive directory walk -R

Usage

bat_img [OPTIONS] --input <INPUT>...

All options

  -i, --input <INPUT>...       File, glob pattern, or directory
  -o, --output <DIR>           Output directory.
                               Omit to process files in-place.
  -R, --recursive              Recurse into subdirectories
  -t, --threads <N>            Thread count [default: CPU core count]
  -q, --quality <1-100>        JPEG/WebP quality (HEIC preserves original
                               quality when omitted)
  -f, --format <FORMAT>        Output format:
                               heic | heif | jpeg | png | webp | tiff | bmp | gif
      --strip-gps              Remove GPS location from EXIF
      --strip-all              Remove all metadata
      --auto-orient            Auto-rotate from EXIF orientation tag
  -r, --resize <WxH>           Resize (use 0 for auto: 1920x0 or 0x1080)
      --filter <FILTER>        Resize filter [default: lanczos3]
                               nearest|triangle|catmull-rom|gaussian|lanczos3
      --no-upscale             Never upscale smaller images
      --border <PIXELS>        Add border N pixels wide on all sides
      --border-color <COLOR>   Border color: name or #rrggbb [default: white]
      --rotate <DEG>           Rotate clockwise: 90 | 180 | 270
      --flip-h                 Flip horizontally
      --flip-v                 Flip vertically
      --brightness <VALUE>     Brightness delta (-100..+100)
      --contrast <VALUE>       Contrast delta (-100..+100)
      --sharpen                Apply unsharp mask
      --grayscale              Convert to grayscale
      --prefix <PREFIX>        Prepend string to output filename
      --suffix <SUFFIX>        Append string to output filename
      --overwrite              Overwrite existing output files
      --dry-run                Preview without writing files
      --quiet                  Suppress output except errors
  -h, --help                   Print help
  -V, --version                Print version

In-place mode

Omitting --output overwrites each original file in place. A temp file is written first and then atomically renamed over the original, so the source is never corrupted if something goes wrong.

# Strip GPS from every HEIC file recursively — no copies made
bat_img -i ~/Pictures -R --strip-gps

# Resize all JPEGs to 2048 px wide, in-place
bat_img -i ./photos -r 2048x0

Note: in-place mode cannot change the file format (e.g. HEIC → WebP). Use --output when changing formats.

Examples

# Add a 20 px black border to all PNGs
bat_img -i ./screenshots --border 20 --border-color black -o ./bordered

# Rotate scans 90° clockwise and convert to grayscale
bat_img -i ./scans --rotate 90 --grayscale -o ./processed

# Convert HEIC → JPEG at quality 90, resize to fit 1920×1080
bat_img -i ./iphone_photos -f jpeg -q 90 -r 1920x1080 -o ./jpegs

# Dry-run — see what would happen without writing anything
bat_img -i ./photos -r 800x600 --strip-gps --dry-run

HEIC support

bat_img can read and write HEIC/HEIF files natively, including:

  • Decoding HEIC photos from iPhone / iPad
  • Re-encoding back to HEIC while preserving the original codec (HEVC / AV1) and file size (unless --quality is specified)
  • Converting HEIC to any other supported format with -f jpeg, -f webp, etc.

License

bat_img is distributed under MIT License. Please see details in LICENSE.

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

bat_img-1.0.4.tar.gz (4.8 kB view details)

Uploaded Source

Built Distributions

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

bat_img-1.0.4-py3-none-win_amd64.whl (3.2 MB view details)

Uploaded Python 3Windows x86-64

bat_img-1.0.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

bat_img-1.0.4-py3-none-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file bat_img-1.0.4.tar.gz.

File metadata

  • Download URL: bat_img-1.0.4.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bat_img-1.0.4.tar.gz
Algorithm Hash digest
SHA256 fa5fdae7eef0abe9a1e1d931a5d249f58780602c3fffecb010f3d6d61fd91903
MD5 3a6de9c1f019561fec851d15621990ee
BLAKE2b-256 56af58071fd97a7515a54aea5a508168561ae89c380142a115beba3a27267734

See more details on using hashes here.

Provenance

The following attestation bundles were made for bat_img-1.0.4.tar.gz:

Publisher: release.yml on john-liu2/bat_img_rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bat_img-1.0.4-py3-none-win_amd64.whl.

File metadata

  • Download URL: bat_img-1.0.4-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bat_img-1.0.4-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 51735624809a837a86dd22e6a8e588a4d3032fe2abb961f6eb1dd1648588122a
MD5 ea2b85550fc414661f1bf26bf2b40964
BLAKE2b-256 4c63807d4c904d5b5674b0c3217f8ac95a344b1b23f4a64e119bffb5e0ff89e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for bat_img-1.0.4-py3-none-win_amd64.whl:

Publisher: release.yml on john-liu2/bat_img_rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bat_img-1.0.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bat_img-1.0.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 68f71bb056ce339776e53f4bc5a82bb8dc4b7700fe5f23fde0b236d17c8bbcc2
MD5 901b863714de232937c86d555d18076a
BLAKE2b-256 9d02509eea3fd15cb77b10e6b0ccb4d097d364962ed0da7211efbc4b35655c27

See more details on using hashes here.

Provenance

The following attestation bundles were made for bat_img-1.0.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on john-liu2/bat_img_rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bat_img-1.0.4-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bat_img-1.0.4-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20d2a83e9bcf202309c1f3f9b8539e42348e4089ed34c5cd35d307d0d58a3d8a
MD5 40b65896b5c1d021d359d589f004dab6
BLAKE2b-256 93ef6560bcebb7120390dc5b6ac10df720e9bb56db25144e1d0bcb7b8f6c0c02

See more details on using hashes here.

Provenance

The following attestation bundles were made for bat_img-1.0.4-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on john-liu2/bat_img_rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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