Javatpoint Logo
Javatpoint Logo

Imagick transposeImage() Function

Imagick transposeImage() Function creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them 90-degrees. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer.


The transpose function doesn't have any parameter; we just need to specify the file on which we want to do the transpose operation.

Return Type

The return type of the transpose Image function is of the Boolean type which means the return type of the transpose Image function will be true if the transpose operation is performed successfully on the image which is passed on which we have to perform the Transpose operation otherwise on the other hand if the transpose operation is not performed successfully or is there any problem in the transpose Image function the return type of the function will be changed to false reflecting that transpose operation has been unsuccessful.

Sample Code:


Imagick transposeImage() Function

The above written is one of the sample code which will call the transpose Image function and transpose the image.jpg the path of this image.jpg represent the absolute path where this image is stored. The path of the image is passed to the ImagicK function on whose object the transpose Image function is callled in the later part and will perform the transpose operation on the specified image.



Imagick transposeImage() Function

This is another example that one is much more elaborated example where we have used a greater number of functions to simulator real time example where transpose Image function can be used. In this example, we have a set of images and on the set of images we are performing some particular operations those operations are some of like setting the background colour of the images then setting the image background colour and resizing those images and adding them those images together.

Another function that is also used with the transposeImage() Function is the transverseImage() Function. The Imagick::transverseImage() method is a PHP built-in function for creating a horizontal mirror image by reflecting pixels along the y-axis. The image is rotated by 270 degrees using this function. In most of the scenario transpose Image function is mostly used with the combination of transverse Image function both of these functions are used in hand in hand in most of the PHP codes.


Thus, in this article, we have seen that how we can use the transpose Image function in PHP with the help of this transpose Image function we can apply the transpose operation on any image whose path we will have to specify. we have understood the application and the use case scenarios of the transpose Image function in PHP with the help of two real time scenarios for which we have written the code and likewise we have seen along with transpose image what other functions are there are also present which we can use for the various operations on the images.

Next TopicPHP Projects

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA