# Wand

Wand is a `ctypes`-based simple ImageMagick binding for Python.

    from wand.image import Image
    from wand.display import display

    with Image(filename='mona-lisa.png') as img:
        print(img.size)
        for r in 1, 2, 3:
            with img.clone() as i:
                i.resize(int(i.width * r * 0.25), int(i.height * r * 0.25))
                i.rotate(90 * r)
                i.save(filename='mona-lisa-{0}.png'.format(r))
                display(i)

You can install it from PyPI (and it requires MagickWand library):

    $ apt-get install libmagickwand-dev
    $ pip install Wand

## Why just another binding?

There are already many MagickWand API bindings for Python, however they are lacking something we need:

- Pythonic and modern interfaces

- Good documentation

- Binding through `ctypes` (not C API) — we are ready to go PyPy!

- Installation using pip

## Requirements

- Python 3.8 or higher

  - CPython 3.8 or higher

  - PyPy 3.10 or higher

- MagickWand library

  - `imagemagick-7.q16` for APT on Debian/Ubuntu

  - `imagemagick` for MacPorts/Homebrew on Mac

  - `ImageMagick-libs` for Yum on CentOS

## User’s guide

- What’s new in Wand 0.7?
  - Python 2 Removal
  - Channel FX
  - Evaluate Images
  - Pyproject.toml
- Installation
  - Install ImageMagick on Debian/Ubuntu
  - Install ImageMagick on Fedora/CentOS
  - Install ImageMagick on Mac
  - Install ImageMagick on Windows
  - Explicitly link to specific ImageMagick
  - Explicitly define ImageMagick library suffix
  - Install Wand on Debian/Ubuntu
  - Install Wand on Fedora
  - Install Wand on FreeBSD
  - Install Wand on Alpine
- Security
- Reading images
  - Open an image file
  - Read an input stream
  - Read a blob
  - Clone an image
  - Hint file format
  - Open an empty image
  - Open a Pseudo Image
  - Read Modifiers
- Writing images
  - Convert images to JPEG
  - Save to file
  - Save to stream
  - Get binary string
- Resizing and cropping
  - Resize images
  - Sample images
  - Crop images
  - Transform images
  - Seam carving (also known as content-aware resizing)
- Image Effects
  - Blur
  - Despeckle
  - Edge
  - Emboss
  - Kuwahara
  - Shade
  - Sharpen
  - Spread
- Special Effects (FX)
  - Add Noise
  - Blue Shift
  - Charcoal
  - Color Matrix
  - Colorize
  - FX
  - Implode
  - Polaroid
  - Sepia Tone
  - Sketch
  - Solarize
  - Stereogram
  - Swirl
  - Tint
  - Vignette
  - Wave
  - Wavelet Denoise
- Transformation
  - Enhance
  - Flip and flop
  - Rotation
  - Statistic
- Colorspace
  - Image types
  - Enable alpha channel
- Color Enhancement
  - Evaluate Expression
  - Function Expression
  - Gamma
  - Level
- Distortion
  - Controlling Resulting Images
  - Affine
  - Affine Projection
  - Arc
  - Barrel
  - Barrel Inverse
  - Bilinear
  - Cylinder & Plane
  - Perspective
  - Polar & Depolar
  - Polynomial
  - Scale Rotate Translate
  - Shepards
- Drawing
  - Arc
  - Bezier
  - Circle
  - Color & Matte
  - Composite
  - Ellipse
  - Lines
  - Paths
  - Point
  - Polygon
  - Polyline
  - Push & Pop
  - Rectangles
  - Texts
  - Word Wrapping
- Reading EXIF
  - Image Profiles
- Layers
  - Coalesce Layers
  - Optimizing Layers
  - Optimizing Transparency
- Montage
  - Thumbnail Size
  - Tile Layout
  - Concatenation Mode
  - Frame Mode
  - Labels
  - Colors
- Morphology
  - Shapes
  - Methods
- Sequence
  - `sequence` is a `Sequence`
  - `Image` versus `SingleImage`
  - Manipulating `SingleImage`
  - Working directly with Image-Stack Iterators
- Resource management
- Quantize
  - Kmeans
  - Posterize
  - Quantize
  - Remap
- Threshold
  - Adaptive Threshold
  - Auto Threshold
  - Black Threshold
  - Color Threshold
  - Ordered Dither
  - Random Threshold
  - Range Threshold
  - White Threshold
- CLI Reference
  - CLI Operators to Wand Methods
  - CLI Options to Wand Properties
- Running tests
  - Skipping tests
  - Using tox
  - Continuous Integration
  - Code Coverage
- Roadmap
  - Very future versions
- Wand Changelog
  - 0.7 series
  - 0.6 series
  - 0.5 series
  - 0.4 series
  - 0.3 series
  - 0.2 series
  - 0.1 series
- Talks and Presentations
  - Talks in 2012

## References

- `wand` — Simple MagickWand API binding for Python
  - `wand.image` — Image objects
  - `ALPHA_CHANNEL_TYPES`
  - `AUTO_THRESHOLD_METHODS`
  - `ArtifactTree`
  - `BaseImage`
  - `CHANNELS`
  - `COLORSPACE_TYPES`
  - `COMPARE_METRICS`
  - `COMPOSITE_OPERATORS`
  - `COMPRESSION_TYPES`
  - `ChannelDepthDict`
  - `ChannelImageDict`
  - `ClosedImageError`
  - `ConnectedComponentObject`
  - `DISPOSE_TYPES`
  - `DISTORTION_METHODS`
  - `DITHER_METHODS`
  - `EVALUATE_OPS`
  - `FILTER_TYPES`
  - `FUNCTION_TYPES`
  - `GRAVITY_TYPES`
  - `HistogramDict`
  - `IMAGE_LAYER_METHOD`
  - `IMAGE_TYPES`
  - `INTERLACE_TYPES`
  - `Image`
  - `ImageProperty`
  - `Iterator`
  - `KERNEL_INFO_TYPES`
  - `MORPHOLOGY_METHODS`
  - `Metadata`
  - `NOISE_TYPES`
  - `ORIENTATION_TYPES`
  - `OptionDict`
  - `PAPERSIZE_MAP`
  - `PIXEL_INTERPOLATE_METHODS`
  - `ProfileDict`
  - `RENDERING_INTENT_TYPES`
  - `SPARSE_COLOR_METHODS`
  - `STATISTIC_TYPES`
  - `STORAGE_TYPES`
  - `UNIT_TYPES`
  - `VIRTUAL_PIXEL_METHOD`
  - `manipulative()`
  - `wand.color` — Colors
  - `Color`
  - `scale_quantum_to_int8()`
  - `wand.font` — Fonts
  - `Font`
  - `wand.drawing` — Drawings
  - `CLIP_PATH_UNITS`
  - `Drawing`
  - `FILL_RULE_TYPES`
  - `FONT_METRICS_ATTRIBUTES`
  - `FontMetrics`
  - `GRAVITY_TYPES`
  - `LINE_CAP_TYPES`
  - `LINE_JOIN_TYPES`
  - `PAINT_METHOD_TYPES`
  - `STRETCH_TYPES`
  - `STYLE_TYPES`
  - `TEXT_ALIGN_TYPES`
  - `TEXT_DECORATION_TYPES`
  - `TEXT_DIRECTION_TYPES`
  - `wand.sequence` — Sequences
  - `Sequence`
  - `SingleImage`
  - `wand.resource` — Global resource management
  - `DestroyedResourceError`
  - `Resource`
  - `ResourceLimits`
  - `genesis()`
  - `limits`
  - `terminus()`
  - `wand.exceptions` — Errors and warnings
  - `BaseError`
  - `BaseFatalError`
  - `BaseWarning`
  - `BlobError`
  - `BlobFatalError`
  - `BlobWarning`
  - `CacheError`
  - `CacheFatalError`
  - `CacheWarning`
  - `CoderError`
  - `CoderFatalError`
  - `CoderWarning`
  - `ConfigureError`
  - `ConfigureFatalError`
  - `ConfigureWarning`
  - `CorruptImageError`
  - `CorruptImageFatalError`
  - `CorruptImageWarning`
  - `DelegateError`
  - `DelegateFatalError`
  - `DelegateWarning`
  - `DrawError`
  - `DrawFatalError`
  - `DrawWarning`
  - `FileOpenError`
  - `FileOpenFatalError`
  - `FileOpenWarning`
  - `ImageError`
  - `ImageFatalError`
  - `ImageWarning`
  - `MissingDelegateError`
  - `MissingDelegateFatalError`
  - `MissingDelegateWarning`
  - `ModuleError`
  - `ModuleFatalError`
  - `ModuleWarning`
  - `MonitorError`
  - `MonitorFatalError`
  - `MonitorWarning`
  - `OptionError`
  - `OptionFatalError`
  - `OptionWarning`
  - `PolicyError`
  - `PolicyFatalError`
  - `PolicyWarning`
  - `RandomError`
  - `RandomFatalError`
  - `RandomWarning`
  - `RegistryError`
  - `RegistryFatalError`
  - `RegistryWarning`
  - `ResourceLimitError`
  - `ResourceLimitFatalError`
  - `ResourceLimitWarning`
  - `StreamError`
  - `StreamFatalError`
  - `StreamWarning`
  - `TypeError`
  - `TypeFatalError`
  - `TypeWarning`
  - `WandError`
  - `WandException`
  - `WandFatalError`
  - `WandLibraryVersionError`
  - `WandRuntimeError`
  - `WandWarning`
  - `XServerError`
  - `XServerFatalError`
  - `XServerWarning`
  - `wand.api` — Low-level interfaces
  - `load_library()`
  - `library`
  - `libmagick`
  - `wand.compat` — Compatibility layer
  - `binary()`
  - `encode_filename()`
  - `to_bytes()`
  - `wand.display` — Displaying images
  - `display()`
  - `wand.version` — Version data
  - `MAGICK_HDRI`
  - `MAGICK_RELEASE_DATE`
  - `MAGICK_RELEASE_DATE_STRING`
  - `MAGICK_VERSION`
  - `MAGICK_VERSION_FEATURES`
  - `MAGICK_VERSION_INFO`
  - `MAGICK_VERSION_NUMBER`
  - `QUANTUM_DEPTH`
  - `QUANTUM_RANGE`
  - `QUANTUM_SCALE`
  - `VERSION`
  - `VERSION_INFO`
  - `configure_options()`
  - `fonts()`
  - `formats()`

## Troubleshooting

### Stack Overflow

There’s a Stack Overflow tag for Wand:

http://stackoverflow.com/questions/tagged/wand

Freely ask questions about Wand including troubleshooting.

Thanks to everyone in the Stack Overflow community for contributions.

### Documentation

The documentation for Wand is hosted by ReadTheDocs.org. The nightly development docs can be found under the latest version, and the most recent release under stable. Previous & maintenance releases are also available.

## Open source

Wand is an open source software initially written by Hong Minhee (for StyleShare), and is currently maintained by E. McConville. See also the complete list of contributors as well. The source code is distributed under MIT license and you can find it at GitHub repository. Check out now:

    $ git clone git://github.com/emcconville/wand.git

If you find a bug, please notify to our issue tracker. Pull requests are always welcome!

Check out Wand Changelog also.

## Indices and tables

- Index

- Module Index

- Search Page