We often find it convenient to flip an image vertically or horizontally using a command line tool. Many programs can do this; we will give examples using ImageMagick and IrfanView.
In general, modifying an image in any way including cropping, flipping, rotating, etc. is a lossy process if the image compression algorithm used is lossy such as JPEG. Lossless compression formats such as PNG will remain lossless with this operation.
We assume the input image is named “in.png”, while the modified image will be written to “out.png”.
ImageMagick is a command-line oriented program available for just about any operating system including Windows, Mac and Linux. The order of the commands is important in ImageMagick.
convert in.png -flip out.png
convert in.png -flop out.png
IrfanView has been popular for decades on Windows and WINE as a no-cost (not open source) image viewing and simple modification program that handles many formats. IrfanView can also be used from the command line under these conditions (we assume 64-bit Irfanview)
- install IrfanView directly, not via the Microsoft App Store.
- add to user PATH
The order of the commands is important. These commands do not open the IrfanView GUI–they are “headless” operations. If there are spaces in the file paths, they must be enclosed in quotes like “c:/my pics/in.png”
i_view64 in.png /vflip /convert=out.png
i_view64 in.png /hflip /convert=out.png