In this specific article we will learn how to read our image through Python wand module. To read image in Wand we use Image() function. To manipulate an image first of all we need to read image in Python.
Parameter Input Type Description image Image make exact copy of image blob bytes opens an image of blob byte array file object opens an image of the file object filename basestring opens image from filename width numbers.Integral the width of anew blank image or an image loaded from raw data height numbers.Integral the height of a new blank image or an image loaded from raw data depth numbers.Integral the depth used when loading raw data. background wand.color.Color an optional background color. colorspace basestring sets the stack’s default colorspace value before reading any images. units basestring paired with resolution for defining an image’s pixel density.
Now we will write a code to print height and width of image.
height = 300 width = 400
We can also read image from a url using
urlopen function from urllib2 generic python library. Let’s see code to print image height and width read from a url.
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