pgmagick Python- Introduction and Installation
pgmagick is a GraphicsMagick binding for Python. This module provides methods for Image Editing and Manipulation. pgmagick is written by Hideo Hattori.
We can do a lot of things using this library such as :
There are two ways to install pgmagick:
- Windows: Execute following command in Command Prompt-
pip install pgmagick
- Ubuntu : Execute the following command in Terminal-
### Ubuntu11.10+ ### $ apt-get install python-pgmagick ### Ubuntu10.04+ ### $ apt-get install libgraphicsmagick++1-dev $ apt-get install libboost-python1.40-dev
Example#1: Let’s discuss a code to resize the image-
For illustration purpose I have taken following sample image-
Example#2: Let’s discuss a code to scale the image-
I have used the same sample image for input as in above example.
if you try running the code at your end, you will see that the image is successfully resampled as per the new dimensions and you will get a new image.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course