Python extension for the CImg library.


Keywords
image, processing, library
License
GPL-3.0
Install
pip install pycimg==1.0.2

Documentation

Build Status Coverage Status Documentation Status 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.

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:

pip install pycimg

Documentation

See readthedocs.

License

The project is licensed under the GPL3 license.