Python binding for G'MIC - A Full-Featured Open-Source Framework for Image Processing
gmic-py
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:
this
Github's project Issue tracker
,
Twitter (#gmicpy)
the pixls.us
gmic-py
forum thread
.
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
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()
Creating a flipbook from a GIF file
Filtering GIF images, ontage'd into an A4 sheet paper.
Example from tutorial 3
Jupyter / Google Colab / IPython integration
gmic-py provides G'MIC console output retrieval and images display emulation for IPython/Jupyter/Google Colab environments:
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
The dropdown lists show the available interpreters, ABIs, and platforms.
Enable javascript to be able to filter the list of wheel files.
Copy a direct link to the current filters
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Hashes for gmic-2.9.2-cp39-cp39-manylinux2014_x86_64.whl
Algorithm
Hash digest
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Hashes for gmic-2.9.2-cp39-cp39-manylinux2010_x86_64.whl
Algorithm
Hash digest
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Hashes for gmic-2.9.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm
Hash digest
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Hashes for gmic-2.9.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm
Hash digest
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Hashes for gmic-2.9.2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm
Hash digest
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Hashes for gmic-2.9.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm
Hash digest
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Hashes for gmic-2.9.2-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm
Hash digest
Uploaded using Trusted Publishing? No
Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.12
File hashes
Hashes for gmic-2.9.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm
Hash digest