Wand transform() function in Python

In order to resize and crop an image at the same time transform() function is used in wand. First crop operation is performed and then resize operation.
Syntax : wand.image.transform(crop=”, resize=”)
Parameters :
Parameter Input Type Description crop basestring A geometry string defining a subregion of the image to crop to resize basestring A geometry string defining the final size of the image 
Input Image:
Example #1:
Let us take an image crop it in dimensions 200×200 and then rescale it to 400×400 pixels.
| # Import Image from wand.image module fromwand.image importImage  # Import display to display final image fromwand.display importdisplay  # Read image using Image function with Image(filename ='koala.jpeg') as img:      # using transform() function     img.transform('200x200', '200 %')      # Saving image     img.save(filename ='transform.jpeg')      # display image     display(img)  | 
Output: 
 
Example #2: Let us take an image crop 50 % of all four corners. 
| # Import Image from wand.image module fromwand.image importImage  # Import display to display final image fromwand.display importdisplay  # Read image using Image function with Image(filename ='koala.jpeg') as img:      # using transform() function     img.transform('50 %')      # Saving image     img.save(filename ='transform1.jpeg')      # display image     display(img)  | 
Output: 
 
Example #3: Scale height of source image to 200px and preserve aspect ratio.
| # Import Image from wand.image module fromwand.image importImage  # Import display to display final image fromwand.display importdisplay  # Read image using Image function with Image(filename ='koala.jpeg') as img:      # using transform() function     img.transform(resize ='x200')      # Saving image     img.save(filename ='transform3.jpeg')      # display image     display(img)  | 
Output: 
<!–
–>

                Wand selective_blur() function in Wand python
            

                Wand function() function in Python
            

                Wand image – Baseimage.kuwahara() function in Python
            

                Wand image.edge function in Python
            

                Wand gaussian_blur() function in Python
            

                Wand crop() function in Python
            

                Wand rotational_blur() function in Python
            

                Wand – blur() function in Python
            

                Python – Image() function in Wand
            

                Python – clone() function in wand library
            
 
				 
					



Please Login to comment…