What’s new in Wand 0.7?¶
This guide doesn’t cover all changes in 0.7. See the full list of changes in 0.7 series.
Python 2 Removal¶
Long overdue, but as Python 2 users slowly migrating to Python 3, Wand no
longer has a user base to support backwards compatibility with Python 2
language. All supporting Python 2 code in wand.compat has been
remove.
Channel FX¶
Wand now supports Channel FX operations to create, copying, and/or extract data from color channels. For example, extracting a meta channel as a new image:
>>> from wand.image import Image
>>>
>>> with Image(filename='tagged_image.psd') as img:
... with img.channel_fx('meta') as meta:
... meta.save(filename='meta_channel.png')
Each channel can be accessed by named (e.g. red, green, blue, etc) or by index (e.g. 0, 1, 2, etc). The following operations are supported:
FX |
Action |
Example |
|---|---|---|
|
Exchange two channels. |
|
|
Copy one channel to another. |
|
|
Assign a constant value to a channel. |
|
|
Write a new image with channels in a specified order. |
|
|
Add a new output image for the next set of channel operations. |
|
|
move to the next input image for the source of channel data. |
|
Evaluate Images¶
Wand can now generate a new Image by evaluating
the source pixel-values read into an image stack.
For example:
>>> from wand.color import Color
>>> from wand.image import Image
>>>
>>> S=dict(width=1, height=1)
>>> with Image() as src:
... # Read 50% & 25% gray images.
... src.read(pseudo='xc:gray50', **S)
... src.read(pseudo='xc:gray25', **S)
... # Create a new image by adding pixel values.
... # ( 50% + 25% = 75% )
... with src.evaluate_images(operator='add') as dst:
... assert dst[0, 0] == Color('gray75')
Pyproject.toml¶
In an effort to modernize the codebase, Wand will start migrating from
setup.py to pyproject.toml. The setup.py file
will still be available for Wand 0.7.x releases.
Note
For “What’s New in Wand 0.6”, see previous announcements.