A Python package for image resizing and PDF to image conversion
Project description
ImageWand
A powerful command-line tool for image manipulation, including PDF to image conversion, image resizing, auto-fixing scanned images, applying filters, and merging scanned images.
Installation
pip install imagewand
Commands Overview
ImageWand provides several commands for different image manipulation tasks:
pdf2img: Convert PDF files to imagesresize: Resize imagesautofix: Automatically straighten and crop scanned imagesfilter: Apply various filters to imagesmerge: Merge multiple scanned images into one
Command Usage
PDF to Images
Convert PDF files to images with customizable DPI and format:
# Basic usage
imagewand pdf2img input.pdf
# Specify output directory and format
imagewand pdf2img input.pdf -o output_dir -f png
# Set custom DPI
imagewand pdf2img input.pdf -d 300
Resize Images
Resize images while maintaining aspect ratio:
# Resize by width
imagewand resize input.jpg -w 800
# Resize by height
imagewand resize input.jpg --height 600
# Specify output path
imagewand resize input.jpg -o resized.jpg -w 800
Auto-fix Scanned Images
Automatically crop and clean up scanned images with two specialized modes:
# Frame mode - Extract photo from contrasting frame/background
imagewand autofix scan.jpg -m frame
imagewand autofix scan.jpg -m frame --margin -2 # More aggressive crop
imagewand autofix scan.jpg -m frame --margin 5 # Add margin
# Border mode - Remove white margins only
imagewand autofix scan.jpg -m border
imagewand autofix scan.jpg -m border -b -2 # More aggressive crop
imagewand autofix scan.jpg -m border -b 5 # Keep more border
# Auto mode (default) - Tries frame detection first, falls back to border removal
imagewand autofix scan.jpg
# Process entire directory
imagewand autofix scans_folder/
Cropping modes explained:
-
frame: Best for photos on contrasting backgrounds (e.g., artwork on black paper)- Use
--marginto adjust cropping (negative for tighter crop, positive for more margin) - Default margin is -1 for slightly aggressive crop
- Use
-
border: Best for documents with white margins- Use
-bto adjust border percentage (negative for tighter crop, positive to keep more border) - Default border is 0 for exact content boundaries
- Use
-
auto: Attempts frame detection first, falls back to border removal if no frame is detected
Output filenames reflect the mode and parameters used:
- Frame mode:
photo_frame.jpgorphoto_frame_m2.jpg(with margin 2) - Border mode:
photo_border.jpgorphoto_border_b5.jpg(with 5% border) - Auto mode:
photo_auto_frame.jpgorphoto_auto_border.jpg
Apply Filters
Apply various image filters:
# Apply single filter
imagewand filter input.jpg -f grayscale
# Apply multiple filters
imagewand filter input.jpg -f "grayscale,sharpen"
# Process directory recursively
imagewand filter images/ -f grayscale -r
# List available filters
imagewand list-filters
Filter Parameters
You can customize filter parameters using the format filtername:param=value:
# Adjust contrast level (default is 1.5)
imagewand filter drawing.jpg -f "contrast:factor=1.2"
# Multiple filters with custom parameters
imagewand filter drawing.jpg -f "saturation:factor=1.3,contrast:factor=1.2,sharpen:factor=1.8"
# Mix of default and custom parameters
imagewand filter drawing.jpg -f "saturation:factor=1.3,contrast,sharpen:factor=2.0"
Common filter parameters:
contrast:factor=1.2- Lighter contrast (default: 1.5)sharpen:factor=1.8- Stronger sharpening (default: 2.0)blur:radius=3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imagewand-0.1.0.tar.gz.
File metadata
- Download URL: imagewand-0.1.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f89920ff19671bf639d25e7b6ab32ad906327f192bb14e9b1f4b7367bb3b464
|
|
| MD5 |
8093b83c048fd220a53279759ca18111
|
|
| BLAKE2b-256 |
5bf2c0adfc5ecc326a56ed33160bdf0bf46b0d71932a39c63c9b980631af99a1
|
File details
Details for the file imagewand-0.1.0-py3-none-any.whl.
File metadata
- Download URL: imagewand-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dac2448fc10aba3de8a0d506ade17825d7e93731678a52b4497fb3675d77d1e8
|
|
| MD5 |
c8d7b3b97780f96c504500b403441537
|
|
| BLAKE2b-256 |
9d10e5403f552f88311f720c3d3c19425440467a5c0afb1d5a8ef0eb9c7e37d6
|