Image Processing on Your Own¶
If you want to try some image processing on your own, outside of the textbook you can do so using the cImage module. The easiest way to get this is to run the command pip install cImage
from the command line. You can also download cImage.py
from The github page . If you get the file from github, put cImage.py
in the same folder as your program you can then do the following to be fully compatible with the code in this book.
import cImage as image
img = image.Image("myfile.gif")
Note
One important caveat about using cImage.py
is that it will only work with GIF files unless you also install the Python Image Library. Don’t worry if you pip install cImage it will automatically take care of this for you. Otherwise, the easiest version to install is called Pillow
. If you have the pip
command installed on your computer this is really easy to install, with pip install pillow
otherwise you will need to follow the instructions on the Python Package Index page. With Pillow installed you will be able to use almost any kind of image that you download.
Note
This workspace is provided for your convenience. You can use this activecode window to try out anything you like.