Wand transform() function in Python Last Updated : 12 Jun, 2020 Comments Improve Suggest changes Like Article Like Report 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 200x200 and then rescale it to 400x400 pixels. Python3 1== # Import Image from wand.image module from wand.image import Image # Import display to display final image from wand.display import display # 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. Python3 1== # Import Image from wand.image module from wand.image import Image # Import display to display final image from wand.display import display # 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. Python3 1== # Import Image from wand.image module from wand.image import Image # Import display to display final image from wand.display import display # 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: Comment More infoAdvertise with us Next Article Wand transverse() function - Python R RahulSabharwal Follow Improve Article Tags : Python Image-Processing Python-wand Practice Tags : python Similar Reads Wand transverse() function - Python The transverse() function is an inbuilt function in the Python Wand ImageMagick library which is used create a horizontal mirror image by reflecting the pixels around the central y-axis. Syntax: transverse() Parameters: This function does not accept any parameter.Return Value: This function returns 2 min read Wand rectangle() function in Python rectangle() function, as the name describes this function is used to draw a circle using wand.drawing object in Python. rectangle takes many arguments like left, top, right, bottom, width, height etc. Syntax : wand.drawing.rectangle(left, top, right, bottom, width, height, radius, xradius, yradius) 2 min read Wand path_start() function in Python We can also draw paths in wand.drawing module. Each path method expects a destination point, and will draw from the current point to the new point. The destination point will become the new current point for the next applied path method. Paths in wand consist of some other methods to draw different 1 min read Wand wave() function in Python wave() function creates a wave like structure from top and bottom of the image. Creates a ripple effect within the image. We can change wavelength as well as amplitude of the image using amplitude & wave_length parameters in wave() function. Syntax : wand.image.wave(amplitude, wave_length) Param 1 min read sum() function in Python The sum of numbers in the list is required everywhere. Python provides an inbuilt function sum() which sums up the numbers in the list. Pythonarr = [1, 5, 2] print(sum(arr))Output8 Sum() Function in Python Syntax Syntax : sum(iterable, start) iterable : iterable can be anything list , tuples or dict 3 min read Wand line() function in Python line() is another drawing function present in wand.drawing module. As the name implies line() function is used to draw a line in the image. line() function only need two arguments that are start and end point of the line that we want to draw. Syntax : wand.drawing.line(start, end) Parameters : Param 2 min read Like