What I want to do is very simple. I've a file.png
, which I want to mirror, i.e. the result should be a "reflection" of the original image.
I know big tools like GIMP and InkScape can do that, but I'm hoping for a command-line utility, something like convert
(which sadly doesn't seem to have such an option, or at least it's not mentioned in the man
page).
From quick reading of this, apparently
convert
calls this option-flop
for horizontal mirroring, and-flip
for vertical. All I needed to do wasIf you want to overwrite in-place and you have a ton of image files in the same folder,
mogrify
from the ImageMagick suite seems to be the easiest way to achieve this:For this particular task
convert
is probably the best way to go, but for this kind of thing I often use thenetpbm
library, which is installable (as you would expect) withapt install netpbm
. ThenFor this task it's overkill, but I often find myself writing one-off scripts to transform or analyze PNM files in peculiar ways that wouldn't be available in
convert
. This is relatively easy, because PNM is pretty much the simplest imaginable bitmap graphic format.