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 2.7 or higher
CPython 2.7 or higher
CPython 3.3 or higher
PyPy 1.5 or higher
MagickWand library
libmagickwand-dev
for APT on Debian/Ubuntuimagemagick
for MacPorts/Homebrew on MacImageMagick-devel
for Yum on CentOS
User’s guide¶
- What’s new in Wand 0.6?
- 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
- Writing images
- Resizing and cropping
- Image Effects
- Special Effects (FX)
- Transformation
- Colorspace
- Color Enhancement
- Distortion
- Drawing
- Reading EXIF
- Layers
- Montage
- Morphology
- Sequence
- Resource management
- Quantize
- Threshold
- CLI Reference
- Running tests
- Roadmap
- Wand Changelog
- Talks and Presentations
References¶
wand
— Simple MagickWand API binding for Pythonwand.image
— Image objectsALPHA_CHANNEL_TYPES
AUTO_THRESHOLD_METHODS
ArtifactTree
BaseImage
BaseImage.adaptive_blur()
BaseImage.adaptive_resize()
BaseImage.adaptive_sharpen()
BaseImage.adaptive_threshold()
BaseImage.alpha_channel
BaseImage.animation
BaseImage.annotate()
BaseImage.antialias
BaseImage.auto_gamma()
BaseImage.auto_level()
BaseImage.auto_orient()
BaseImage.auto_threshold()
BaseImage.background_color
BaseImage.black_threshold()
BaseImage.blue_primary
BaseImage.blue_shift()
BaseImage.blur()
BaseImage.border()
BaseImage.border_color
BaseImage.brightness_contrast()
BaseImage.c_clear_exception
BaseImage.c_destroy_resource
BaseImage.c_get_exception
BaseImage.c_is_resource
BaseImage.canny()
BaseImage.caption()
BaseImage.cdl()
BaseImage.charcoal()
BaseImage.chop()
BaseImage.clahe()
BaseImage.clamp()
BaseImage.clone()
BaseImage.clut()
BaseImage.coalesce()
BaseImage.color_decision_list()
BaseImage.color_map()
BaseImage.color_matrix()
BaseImage.color_threshold()
BaseImage.colorize()
BaseImage.colors
BaseImage.colorspace
BaseImage.combine()
BaseImage.compare()
BaseImage.complex()
BaseImage.compose
BaseImage.composite()
BaseImage.composite_channel()
BaseImage.compression
BaseImage.compression_quality
BaseImage.concat()
BaseImage.connected_components()
BaseImage.contrast()
BaseImage.contrast_stretch()
BaseImage.convex_hull()
BaseImage.crop()
BaseImage.cycle_color_map()
BaseImage.decipher()
BaseImage.deconstruct()
BaseImage.delay
BaseImage.depth
BaseImage.deskew()
BaseImage.despeckle()
BaseImage.dirty
BaseImage.dispose
BaseImage.distort()
BaseImage.edge()
BaseImage.emboss()
BaseImage.encipher()
BaseImage.enhance()
BaseImage.equalize()
BaseImage.evaluate()
BaseImage.export_pixels()
BaseImage.extent()
BaseImage.features()
BaseImage.fft()
BaseImage.flip()
BaseImage.flop()
BaseImage.font
BaseImage.font_antialias
BaseImage.font_path
BaseImage.font_size
BaseImage.format
BaseImage.forward_fourier_transform()
BaseImage.frame()
BaseImage.function()
BaseImage.fuzz
BaseImage.fx()
BaseImage.gamma()
BaseImage.gaussian_blur()
BaseImage.get_image_distortion()
BaseImage.gravity
BaseImage.green_primary
BaseImage.hald_clut()
BaseImage.height
BaseImage.histogram
BaseImage.hough_lines()
BaseImage.ift()
BaseImage.implode()
BaseImage.import_pixels()
BaseImage.interlace_scheme
BaseImage.interpolate_method
BaseImage.inverse_fourier_transform()
BaseImage.iterator_first()
BaseImage.iterator_get()
BaseImage.iterator_last()
BaseImage.iterator_length()
BaseImage.iterator_next()
BaseImage.iterator_previous()
BaseImage.iterator_reset()
BaseImage.iterator_set()
BaseImage.kmeans()
BaseImage.kurtosis
BaseImage.kurtosis_channel()
BaseImage.kuwahara()
BaseImage.label()
BaseImage.length_of_bytes
BaseImage.level()
BaseImage.level_colors()
BaseImage.levelize()
BaseImage.levelize_colors()
BaseImage.linear_stretch()
BaseImage.liquid_rescale()
BaseImage.local_contrast()
BaseImage.loop
BaseImage.magnify()
BaseImage.matte_color
BaseImage.maxima
BaseImage.mean
BaseImage.mean_channel()
BaseImage.mean_shift()
BaseImage.merge_layers()
BaseImage.minima
BaseImage.minimum_bounding_box()
BaseImage.mode()
BaseImage.modulate()
BaseImage.morphology()
BaseImage.motion_blur()
BaseImage.negate()
BaseImage.noise()
BaseImage.normalize()
BaseImage.oil_paint()
BaseImage.opaque_paint()
BaseImage.optimize_layers()
BaseImage.optimize_transparency()
BaseImage.options
BaseImage.ordered_dither()
BaseImage.orientation
BaseImage.page
BaseImage.page_height
BaseImage.page_width
BaseImage.page_x
BaseImage.page_y
BaseImage.parse_meta_geometry()
BaseImage.percent_escape()
BaseImage.polaroid()
BaseImage.polynomial()
BaseImage.posterize()
BaseImage.quantize()
BaseImage.quantum_range
BaseImage.random_threshold()
BaseImage.range_channel()
BaseImage.range_threshold()
BaseImage.read_mask()
BaseImage.red_primary
BaseImage.region()
BaseImage.remap()
BaseImage.rendering_intent
BaseImage.resample()
BaseImage.reset_coords()
BaseImage.reset_sequence()
BaseImage.resize()
BaseImage.resolution
BaseImage.roll()
BaseImage.rotate()
BaseImage.rotational_blur()
BaseImage.sample()
BaseImage.sampling_factors
BaseImage.scale()
BaseImage.scene
BaseImage.seed
BaseImage.selective_blur()
BaseImage.sepia_tone()
BaseImage.sequence
BaseImage.shade()
BaseImage.shadow()
BaseImage.sharpen()
BaseImage.shave()
BaseImage.shear()
BaseImage.sigmoidal_contrast()
BaseImage.signature
BaseImage.similarity()
BaseImage.size
BaseImage.sketch()
BaseImage.skewness
BaseImage.smush()
BaseImage.solarize()
BaseImage.sparse_color()
BaseImage.splice()
BaseImage.spread()
BaseImage.standard_deviation
BaseImage.statistic()
BaseImage.stegano()
BaseImage.strip()
BaseImage.swirl()
BaseImage.texture()
BaseImage.threshold()
BaseImage.thumbnail()
BaseImage.ticks_per_second
BaseImage.tint()
BaseImage.transform()
BaseImage.transform_colorspace()
BaseImage.transparent_color()
BaseImage.transparentize()
BaseImage.transpose()
BaseImage.transverse()
BaseImage.trim()
BaseImage.type
BaseImage.unique_colors()
BaseImage.units
BaseImage.unsharp_mask()
BaseImage.vignette()
BaseImage.virtual_pixel
BaseImage.wand
BaseImage.watermark()
BaseImage.wave()
BaseImage.wavelet_denoise()
BaseImage.white_balance()
BaseImage.white_point
BaseImage.white_threshold()
BaseImage.width
BaseImage.write_mask()
CHANNELS
COLORSPACE_TYPES
COMPARE_METRICS
COMPOSITE_OPERATORS
COMPRESSION_TYPES
ChannelDepthDict
ChannelImageDict
ClosedImageError
ConnectedComponentObject
ConnectedComponentObject.area
ConnectedComponentObject.center_x
ConnectedComponentObject.center_y
ConnectedComponentObject.centroid
ConnectedComponentObject.clone_from_cc_object_info()
ConnectedComponentObject.clone_from_extra_70A_info()
ConnectedComponentObject.clone_from_extra_710_info()
ConnectedComponentObject.height
ConnectedComponentObject.left
ConnectedComponentObject.mean_color
ConnectedComponentObject.merge
ConnectedComponentObject.metric
ConnectedComponentObject.offset
ConnectedComponentObject.size
ConnectedComponentObject.top
ConnectedComponentObject.width
DISPOSE_TYPES
DISTORTION_METHODS
DITHER_METHODS
EVALUATE_OPS
FILTER_TYPES
FUNCTION_TYPES
GRAVITY_TYPES
HistogramDict
IMAGE_LAYER_METHOD
IMAGE_TYPES
INTERLACE_TYPES
Image
Image.animation
Image.artifacts
Image.blank()
Image.channel_depths
Image.channel_images
Image.clear()
Image.close()
Image.compare_layers()
Image.convert()
Image.data_url()
Image.from_array()
Image.image_add()
Image.image_get()
Image.image_remove()
Image.image_set()
Image.image_swap()
Image.make_blob()
Image.metadata
Image.mimetype
Image.montage()
Image.ping()
Image.profiles
Image.pseudo()
Image.read()
Image.reset_sequence()
Image.save()
Image.stereogram()
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
— ColorsColor
Color.alpha
Color.alpha_int8
Color.alpha_quantum
Color.black
Color.black_int8
Color.black_quantum
Color.blue
Color.blue_int8
Color.blue_quantum
Color.c_clear_exception
Color.c_destroy_resource
Color.c_equals()
Color.c_get_exception
Color.c_is_resource
Color.cyan
Color.cyan_int8
Color.cyan_quantum
Color.dirty
Color.from_hsl()
Color.green
Color.green_int8
Color.green_quantum
Color.hsl()
Color.magenta
Color.magenta_int8
Color.normalized_string
Color.red
Color.red_int8
Color.red_quantum
Color.string
Color.yellow
Color.yellow_int8
Color.yellow_quantum
scale_quantum_to_int8()
wand.font
— FontsFont
wand.drawing
— DrawingsCLIP_PATH_UNITS
Drawing
Drawing.affine()
Drawing.alpha()
Drawing.arc()
Drawing.bezier()
Drawing.border_color
Drawing.c_clear_exception
Drawing.c_destroy_resource
Drawing.c_get_exception
Drawing.c_is_resource
Drawing.circle()
Drawing.clip_path
Drawing.clip_rule
Drawing.clip_units
Drawing.clone()
Drawing.color()
Drawing.comment()
Drawing.composite()
Drawing.draw()
Drawing.ellipse()
Drawing.fill_color
Drawing.fill_opacity
Drawing.fill_rule
Drawing.font
Drawing.font_family
Drawing.font_resolution
Drawing.font_size
Drawing.font_stretch
Drawing.font_style
Drawing.font_weight
Drawing.get_font_metrics()
Drawing.gravity
Drawing.line()
Drawing.matte()
Drawing.opacity
Drawing.path_close()
Drawing.path_curve()
Drawing.path_curve_to_quadratic_bezier()
Drawing.path_elliptic_arc()
Drawing.path_finish()
Drawing.path_horizontal_line()
Drawing.path_line()
Drawing.path_move()
Drawing.path_start()
Drawing.path_vertical_line()
Drawing.point()
Drawing.polygon()
Drawing.polyline()
Drawing.pop()
Drawing.pop_clip_path()
Drawing.pop_defs()
Drawing.pop_pattern()
Drawing.push()
Drawing.push_clip_path()
Drawing.push_defs()
Drawing.push_pattern()
Drawing.rectangle()
Drawing.rotate()
Drawing.scale()
Drawing.set_fill_pattern_url()
Drawing.set_stroke_pattern_url()
Drawing.skew()
Drawing.stroke_antialias
Drawing.stroke_color
Drawing.stroke_dash_array
Drawing.stroke_dash_offset
Drawing.stroke_line_cap
Drawing.stroke_line_join
Drawing.stroke_miter_limit
Drawing.stroke_opacity
Drawing.stroke_width
Drawing.text()
Drawing.text_alignment
Drawing.text_antialias
Drawing.text_decoration
Drawing.text_direction
Drawing.text_encoding
Drawing.text_interline_spacing
Drawing.text_interword_spacing
Drawing.text_kerning
Drawing.text_under_color
Drawing.translate()
Drawing.vector_graphics
Drawing.viewbox()
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
— SequencesSequence
SingleImage
wand.resource
— Global resource managementDestroyedResourceError
Resource
ResourceLimits
genesis()
limits
terminus()
wand.exceptions
— Errors and warningsBaseError
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 interfacesload_library()
library
libmagick
wand.compat
— Compatibility layerPY3
abc
binary()
binary_type
encode_filename()
file_types
string_type
text_type
to_bytes()
xrange
wand.display
— Displaying imagesdisplay()
wand.version
— Version dataMAGICK_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.