Image Manipulation with Python

in python •  8 years ago 


Original Image

Image Source: www.popmatters.com

I’m using Python 3 + SciKit-Image (Image Library)


Brew Installing Python 3

I selected this Library to use because it's one of the most active developed around + well documented API for Python.

scikit-image is an image processing library that implements algorithms and utilities for use in research, education and industry applications. It is released under the liberal Modified BSD open source license, provides a well-documented API in the Python programming language, and is developed by an active, international team of collaborators.

Just a quick note, make sure to install all these libraries before installing the SciKit-Image

  • numpy ( command: pip3 install numpy );
  • freetype ( command: brew install freetype );
  • matplotlib ( command: pip3 install matplotlib );
  • pkg-config (command: brew install pkg-config );

To install SciKit, use this command
pip3 install -U scikit-image
or access here http://scikit-image.org/download.html

After installing the SciKit-Image Library, let’s start to play around with the image.

Grayscale Filter

import skimage.io as io
from skimage.color import rgb2gray 

#Open the Original Image
img = io.imread('assassins-creed-original.jpg')

#Apply the Grayscale Filter to the Image
img_grayscale = rgb2gray(img)

#Save the new Grayscale Image
io.imsave('assassins-creed-grayscale.jpg',img_grayscale)




Result Image

If you would like to suggest a theme for a future article on Development, please fell free to leave them in the comments.

Thank you all for the support :D


Additional Notes

  • Platform used : MacOS Sierra 10.12

Other Resources:

Github: https://github.com/eliasrodrigues/image-python
Python:

If you’re on a Mac (using homebrew): “brew install python3”
If you’re on a Linux(ex: Ubuntu) : “apt-get install python3”
If you’re on Windows : “https://www.python.org/downloads/

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!