How to Flip an Image Vertically in ImageMagick
This article provides a quick guide on how to flip an image vertically using the ImageMagick command-line tool. You will learn the exact command-line flag required for a vertical flip, how it differs from a horizontal flip, and see practical examples of the command in action to help you efficiently process your images.
The Vertical Flip Flag:
-flip
To flip an image vertically (reflecting it upside down along the
horizontal axis) using ImageMagick’s convert command, you
use the -flip flag.
Basic Command Syntax
magick convert input.jpg -flip output.jpgNote: If you are using ImageMagick v7 or newer, the
converttool is built into the mainmagickcommand, so you can simply usemagick input.jpg -flip output.jpg.
-flip vs. -flop
It is easy to mix up the two reflection flags available in ImageMagick. Here is a quick reference to keep them straight:
-flip: Reflects the image vertically (top to bottom).-flop: Reflects the image horizontally (left to right).
Examples of Usage
If you want to perform a vertical flip on a PNG image named
photo.png and save it as a new file, the command looks like
this:
magick convert photo.png -flip flipped_photo.pngIf you ever need to flip an image both vertically and horizontally at the same time, you can combine the flags in a single command:
magick convert photo.png -flip -flop symmetrical_photo.png