What's new in Wand 0.7?
=======================

This guide doesn't cover all changes in 0.7. See the full list of changes
in :ref:`changelog-0.7`.

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 :mod:`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.                                         | ``red <=> green``    |
+---------+----------------------------------------------------------------+----------------------+
| ``=>``  | Copy one channel to another.                                   | ``red => green``     |
+---------+----------------------------------------------------------------+----------------------+
| ``=``   | Assign a constant value to a channel.                          | ``red = 50%``        |
+---------+----------------------------------------------------------------+----------------------+
| ``,``   | Write a new image with channels in a specified order.          | ``red, green, blue`` |
+---------+----------------------------------------------------------------+----------------------+
| ``;``   | Add a new output image for the next set of channel operations. | ``red; green``       |
+---------+----------------------------------------------------------------+----------------------+
| ``|``   | move to the next input image for the source of channel data.   | ``| grey => alpha``  |
+---------+----------------------------------------------------------------+----------------------+


Evaluate Images
'''''''''''''''

Wand can now generate a new :class:`Image <wand.image.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
:file:`setup.py` to :file:`pyproject.toml`.  The :file:`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`_.

    .. _previous announcements: 0.6.html