Skip to main content

Binary Python3 bindings for the G'MIC C++ image processing library

Project description

G'MIC Logo Python Logo

Python binding for G'MIC - A Full-Featured Open-Source Framework for Image Processing

https://gmic.eu

gmic-py

PyPI version shields.io PyPI download monthly PyPI license PyPI format PyPI pyversions PyPI implementation PyPI status Read the Docs

CPython GMIC Optimized Python package (Source and Debian/Ubuntu OS compilation) CPython GMIC Manylinux 2010 & 2014 x86_64 Optimized No-release CPython GMIC Debug Python package (Source and Debian/Ubuntu OS compilation) CPython GMIC MacOS Optimized Build

gmic-py is the official Python 3 binding for the G'MIC C++ image processing library purely written with Python's C API. Its Python package name on pypi.org is just gmic. This project lives under the CeCILL license (similar to GNU Public License).

You can use the gmic Python module for projects related to desktop or server-side graphics software, numpy, video-games, image procesing.

Check out the gmic-py documentation website (readthedocs) for Quickstart, Tutorials, API Reference and gmic-py third-party integrations.

gmic-py's slowly growing community gravitates around:

gmic-py 2.9.2 release plan

gmic-blender is a Blender3d add-on bundling gmic-py and allowing you use a new gmic module from there without installing anything more.

Quickstart

First install the G'MIC Python module in your (virtual) environment.

pip install gmic

G'MIC is a language processing framework, interpreter and image-processing scripting language. Here is how to load gmic, and evaluate some G'MIC commands with an interpreter.

import gmic
gmic.run("sp earth blur 4") # On Linux a window shall open-up with a blurred earth
gmic.run("sp rose fx_bokeh 3,8,0,30,8,4,0.3,0.2,210,210,80,160,0.7,30,20,20,1,2,170,130,20,110,0.15,0 output rose_with_bokeh.png") # Save a rose with bokeh effect to file

A full-featured gmic-py Quickstart tutorial is available here. Tutorials on various topics are available in the documentation.

Documentation

Full documentation is being written at https://gmic-py.readthedocs.io/.

Supported platforms

gmic-py works for Linux and Mac OS x 64bits architecture x Python >= 3.6. Windows support is planned for Q4 2020.

In case your environment is a type of Unix, but compiling from source is needed, note that the pip installer will download gmic-py's source and most possibly compile it very well. See the CONTRIBUTING.md file and the documentation for tips on building gmic-py for your own OS.

Examples

All examples belong in the examples/ folder.

Some of them correspond to tutorials on gmic-py's readthedocs website.

Applying a simple filter

import gmic
gmic.run("sample apples rodilius 10 display") # more at https://gmic.eu/reference/rodilius.html

Example from tutorial 1

Apple with rodilius effect

Numpy integration

gmic-py supports GmicImage input/output with numpy, scikit-image and Pillow (PIL) if any of those are installed.

Example from the Quickstart tutorial

import numpy
from matplotlib import pyplot as plt
import gmic

images = []
gmic.run("sp apples blur_x 30 fx_freaky_bw 90,20,0,0,0,0", images) # horizontal blur+special black&white
numpy_im = images[0].to_numpy_helper(interleave=True,permute="yxzc", squeeze_shape=True, astype=numpy.uint8)
plt.imshow(numpy_im, plt.get_cmap('gray'))
plt.show()

Numpy + Matplotlib

Creating a flipbook from a GIF file

Filtering GIF images, ontage'd into an A4 sheet paper.

Example from tutorial 3

Example flipping

Jupyter / Google Colab / IPython integration

gmic-py provides G'MIC console output retrieval and images display emulation for IPython/Jupyter/Google Colab environments:

Jupyter support example

Details on the related Jupyter/IPython/* support documentation page.

Using your camera with G'MIC's optional OpenCV linking (advanced)

If your machine has libopencv installed and you build gmic-py from source (ie. python setup.py build), G'MIC OpenCV commands will be enabled.

Example G'MIC OpenCV script

Live example

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gmic, version 2.9.2
Filename, size File type Python version Upload date Hashes
Filename, size gmic-2.9.2-cp36-cp36m-manylinux2010_x86_64.whl (4.5 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size gmic-2.9.2-cp36-cp36m-manylinux2014_x86_64.whl (5.4 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size gmic-2.9.2-cp37-cp37m-manylinux2010_x86_64.whl (4.5 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size gmic-2.9.2-cp37-cp37m-manylinux2014_x86_64.whl (5.4 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size gmic-2.9.2-cp38-cp38-manylinux2010_x86_64.whl (4.5 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size gmic-2.9.2-cp38-cp38-manylinux2014_x86_64.whl (5.4 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size gmic-2.9.2-cp39-cp39-manylinux2010_x86_64.whl (4.5 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size gmic-2.9.2-cp39-cp39-manylinux2014_x86_64.whl (5.3 MB) File type Wheel Python version cp39 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page