Metadata-Version: 2.1
Name: avif
Version: 0.4.0
Summary: Python bindings for libavif
Home-page: https://github.com/Julian/avif
Author: Julian Berman
Author-email: Julian+avif@GrayVines.com
License: UNKNOWN
Project-URL: Source, https://github.com/Julian/avif
Project-URL: Issues, https://github.com/Julian/avif/issues/
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Description-Content-Type: text/x-rst
Requires-Dist: attrs
Requires-Dist: cffi (>=1.0.0)

========
``avif``
========

|PyPI| |Pythons| |CI|

.. |PyPI| image:: https://img.shields.io/pypi/v/avif.svg
  :alt: PyPI version
  :target: https://pypi.org/project/avif/

.. |Pythons| image:: https://img.shields.io/pypi/pyversions/avif.svg
  :alt: Supported Python versions
  :target: https://pypi.org/project/avif/

.. |CI| image:: https://github.com/Julian/avif/workflows/CI/badge.svg
  :alt: Build status
  :target: https://github.com/Julian/avif/actions?query=workflow%3ACI


Python bindings for `libavif <https://github.com/AOMediaCodec/libavif>`_ (via
`CFFI <https://cffi.readthedocs.io/en/latest/>`_)


Installation from PyPI
----------------------

``avif`` is available `via PyPI <https://pypi.org/project/avif/>`_, with
wheels built for many common platforms. It can be installed via your
favorite Python package manager, e.g.:

.. code-block:: sh

    $ pip install avif


Installation from source
------------------------


To install this module from source you will need to compile ``libavif`` yourself.
If you want to make use of the decoder you will also need to compile one
(decoders/encoders can be compiled from ``libavif``).


**List of available AV1 decoders:**

- `aom <https://aomedia.googlesource.com/aom>`_ (recommended)
- `dav1d <https://code.videolan.org/videolan/dav1d>`_
- `libgav1 <https://chromium.googlesource.com/codecs/libgav1>`_
- `rav1e <https://github.com/xiph/rav1e>`_
- `svt <https://github.com/AOMediaCodec/SVT-AV1>`_

If you compile ``avif`` without an AV1 decoder you will get
``AVIFError: No codec available`` raised when you try to get a result,
but you will still be able to import python module.

The installation steps below show how to compile ``libavif`` with the ``aom``
decoder.


Platform-Specific Steps
^^^^^^^^^^^^^^^^^^^^^^^

- `Linux <INSTALL.linux.rst>`_
- `Windows <INSTALL.win.rst>`_


Examples
--------

Examples can be found under `examples
<https://github.com/Julian/avif/tree/main/examples>`_ directory.

You can use ``sample.avif`` if you don't have any avif encoded image
for testing.  Sample is 128x128 pixels in size and it's all white
*(RGBA: 255, 255, 255, 255)*.

To test if library works properly you can run:

.. code-block:: bash

   python3 examples/avif_example_decode_file.py examples/sample.avif

Correct output::

   Parsed AVIF: 128x128 (8bpc)
   * First pixel: RGBA(255, 255, 255, 255)


