Registry / data / wand
library0.7.2pypypi✓ verified 24d ago

Wand is a ctypes-based simple ImageMagick binding for Python. It provides a Pythonic interface to the MagickWand API, enabling comprehensive image manipulation tasks such as resizing, cropping, rotating, applying effects, and converting between various image formats. The current version is 0.7.0, and it is actively maintained with regular releases.

pip install wand
INSTALL
IMPORT
SIG · WAND
W
wand
datapythonv0.7.2
Install
1.7s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Image
from wand.image import Image
from wand import *
Importing '*' is discouraged in production code. Explicitly import 'Image' from 'wand.image' for clarity and to avoid namespace pollution.

This quickstart demonstrates how to load an image, resize it, and apply a blur effect using Wand. It also includes error handling and a method to create a dummy image for testing if one isn't available. Ensure ImageMagick is installed on your system for Wand to function.

import os from wand.image import Image # Create a dummy image file for demonstration if it doesn't exist dummy_image_path = 'example.jpg' if not os.path.exists(dummy_image_path): try: # Using a minimal Pillow to create a dummy image if Wand can't (no ImageMagick installed yet) from PIL import Image as PImage PImage.new('RGB', (400, 300), color = 'red').save(dummy_image_path) print(f"Created a dummy image: {dummy_image_path}") except ImportError: print("Please create an 'example.jpg' file or install Pillow (pip install Pillow) to run this quickstart.") exit() # Ensure ImageMagick can be found if MAGICK_HOME is needed (e.g., on some macOS/Windows installs) # os.environ['MAGICK_HOME'] = '/opt/homebrew' # Example for Homebrew on macOS try: with Image(filename=dummy_image_path) as img: print(f"Original size: {img.width}x{img.height}") # Resize the image to 200x150 pixels img.resize(200, 150) output_path = 'resized_example.jpg' img.save(filename=output_path) print(f"Resized image saved to {output_path} with size: {img.width}x{img.height}") # Apply a blur effect img.blur(radius=0, sigma=3) blurred_output_path = 'blurred_example.jpg' img.save(filename=blurred_output_path) print(f"Blurred image saved to {blurred_output_path}") except Exception as e: print(f"An error occurred: {e}") print("Make sure ImageMagick is installed and correctly configured (e.g., MAGICK_HOME environment variable).")
Debug
Known issues
breakingWand 0.7.0 removed support for Python 2. All Python 2 compatibility code has been eliminated.
fix
Upgrade to Python 3.8 or higher. For projects requiring Python 2, use Wand < 0.7.0, though this is not recommended due to lack of security updates.
affects: >=0.7.0
gotchaWand is a binding to the ImageMagick C library and requires ImageMagick to be installed on your system. It does not ship with ImageMagick itself.
fix
Install ImageMagick system-wide. For Debian/Ubuntu, use `sudo apt-get install imagemagick libmagickwand-dev`. For macOS (Homebrew), use `brew install imagemagick`. On Windows, download a prebuilt binary and ensure 'Install development headers and libraries for C and C++' is checked.
affects: All versions
gotchaFor some installations (e.g., Homebrew on Apple Silicon macOS, or custom ImageMagick paths on Windows/Linux), you may need to set the `MAGICK_HOME` environment variable to the ImageMagick installation directory for Wand to find it.
fix
Set the `MAGICK_HOME` environment variable to the path where ImageMagick is installed (e.g., `export MAGICK_HOME=/opt/homebrew` on macOS or `set MAGICK_HOME=C:\Program Files\ImageMagick-7.0.x-Q16` on Windows).
affects: All versions
gotchaFailing to use the `with` statement (context manager) with `wand.image.Image` objects, or manually calling `.close()`, can lead to memory leaks, especially in long-running applications.
fix
Always use `with Image(filename='...') as img:` when working with image objects to ensure proper resource cleanup. If not using `with`, explicitly call `img.close()` when done.
affects: All versions
gotchaWhen processing PDFs, Wand defaults to a resolution of 72 DPI. If the original PDF has a higher resolution or if high-quality output is needed, this default can lead to significant quality degradation or unexpected scaling issues.
fix
Specify the desired resolution explicitly when opening a PDF: `with Image(filename='input.pdf', resolution=300) as img:`. This ensures Wand processes the PDF at the intended quality.
affects: All versions
Errors
Common errors & fixes
wand.exceptions.MissingDelegateError
The ImageMagick library, which `wand` depends on, is not installed on your system or cannot be found in the system's PATH.
fix
Install ImageMagick on your operating system (e.g., `sudo apt-get install imagemagick libmagickwand-dev` on Debian/Ubuntu, `brew install imagemagick` on macOS, or download from imagemagick.org for Windows and ensure it's in your system PATH).
ImportError: DLL load failed while importing wand.api: The specified module could not be found.
On Windows, this error occurs when the ImageMagick dynamic link libraries (DLLs) required by `wand` cannot be located by the Python interpreter, typically because ImageMagick's bin directory is not in the system's PATH.
fix
Ensure ImageMagick is installed on your Windows system and that its 'bin' directory (e.g., C:\Program Files\ImageMagick-7.X.X-QXX\bin) is added to your system's PATH environment variable.
wand.exceptions.BlobError: not a JPEG file
This error indicates that `wand` attempted to interpret the input data as a JPEG file but found that it was either corrupted, not a valid JPEG, or was actually a different image format.
fix
Verify that the input file path is correct, the file itself is a valid and uncorrupted JPEG image, and that its content matches the expected format. Ensure you're passing correct image data (file path or bytes) to the `Image` constructor.
MemoryError: failed to allocate memory
The system ran out of available memory while `wand` (or ImageMagick underneath) attempted to process a large image or perform a memory-intensive operation.
fix
Reduce the image's dimensions or resolution, process images in smaller batches, free up system memory, or ensure image objects are properly disposed using `with Image(...) as img:` or `img.destroy()` to release resources.
Upgrade
Version history
0.7.2latest on PyPI · released Jun 25, 2026
Audit
Dependencies
ImageMagickrequiredWand is a Python binding for the ImageMagick C library and requires a system-wide installation of ImageMagick.
libmagickwand-devoptionalDevelopment headers for ImageMagick are often required for Wand to link correctly on Linux distributions.
ghostscriptoptionalRequired for rendering PDF files or using FreeType font features with ImageMagick.
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
wand — pip install wand · libregistry