Metadata-Version: 2.2
Name: pycimg
Version: 2.0.8
Summary: Python extension for the CImg library.
Author: Dominik Brugger
License: GPL-3.0-or-later
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Project-URL: homepage, https://github.com/d0m3nik/pycimg
Requires-Python: >=3.9
Requires-Dist: numpy
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Description-Content-Type: text/x-rst

.. image:: https://github.com/d0m3nik/pycimg/workflows/Build/badge.svg
  :target: https://github.com/d0m3nik/pycimg/actions
  :alt: Build Status
.. image:: https://codecov.io/gh/d0m3nik/pycimg/branch/feature_pybind/graph/badge.svg?token=FGVRN9LTIK
  :target: https://codecov.io/gh/d0m3nik/pycimg
  :alt: Coverage Status
.. image:: https://readthedocs.org/projects/pycimg/badge/?version=latest
  :target: http://pycimg.readthedocs.io/en/latest/?badge=latest
  :alt: Documentation Status
.. image:: https://badge.fury.io/py/pycimg.svg
  :target: https://badge.fury.io/py/pycimg
  :alt: PyPI version

README
======
**pycimg** is a python extension for the CImg_ library.

The package contains a single class CImg that provides access to the
image processing methods of the CImg_ library. 

Pixel data of CImg objects can be accessed as a numpy_ array.

Vice versa new CImg objects can be created from pixel data in a numpy_ array 
or an image file. Supported file formats are png_, jpeg_, tiff_, bmp, and cimg.

.. code-block:: python

     from pycimg import CImg
     import numpy as np

     # Load image from file
     img = CImg('test/test.png')
     img.display()

     # Access pixel data as numpy array
     arr = img.asarray()
     # Set pixels in upper left 100 x 100 px rectangle
     arr[:,:,0:99,0:99] = 0
     # Pixel data is shared with the image instance
     img.display()

     # Create image from numpy array
     img = CImg(np.random.randn(100,100))

Features
--------
- Access pixel data as a numpy_ array.
- Builtin support for reading/writing png_, jpeg_, and tiff_ image formats.

Installation
------------
Install pycimg by running:

.. code-block:: bash

   pip install pycimg

Local development
-----------------

This project uses `uv <https://docs.astral.sh/uv/>`_ for dependency management.
Install uv, then run:

.. code-block:: bash

   uv sync --dev
   conan profile detect --force
   conan install . --build=missing
   uv run pip install -e . -C "skbuild.cmake.args=-DCMAKE_TOOLCHAIN_FILE:FILEPATH=conan_toolchain.cmake"

Run tests with:

.. code-block:: bash

   uv run pytest --cov=pycimg tests/

Release workflow
----------------

This project uses `python-semantic-release`_ to automatically bump
the version based on commit messages when changes are merged to
``master``:

- ``fix: ...`` commits increment the patch version (e.g. 2.0.2 → 2.0.3)
- ``feat: ...`` commits increment the minor version (e.g. 2.0.2 → 2.1.0)
- ``BREAKING CHANGE: ...`` commits increment the major version (e.g. 2.0.2 → 3.0.0)

Steps to publish a new release:

#. Merge the feature branch into ``master``.
#. The CI ``semantic_release`` job bumps the version, commits, and
   pushes a new ``v*`` tag.
#. On GitHub, create a `Release`_ from the newly pushed tag.
#. The CI ``upload_pypi`` job publishes the built wheels and source
   distribution to PyPI.

.. _python-semantic-release: https://python-semantic-release.readthedocs.io/
.. _Release: https://github.com/d0m3nik/pycimg/releases

Documentation
-------------
See readthedocs_.

License
-------
The project is licensed under the GPL3 license.

.. _CImg: http://www.cimg.eu
.. _numpy: http://www.numpy.org/
.. _jpeg: https://github.com/libjpeg-turbo/libjpeg-turbo
.. _png: https://github.com/glennrp/libpng/
.. _tiff: https://gitlab.com/libtiff/libtiff
.. _readthedocs: http://pycimg.readthedocs.io/en/latest/ 
