3 ms·
The ImageMagick utility mogrify. By default (without specifying extra command-line options) it overwrites the input files. [1] In decades of computer use, tha
by jasode 5y ago
The ImageMagick utility mogrify.
By default (without specifying extra command-line options) it overwrites the input files. [1]
In decades of computer use, that is the only command line tool that tricked me into destroying my data because I didn't realize it works differently from all the other tools I use that don't do that.
Usually, a command line utility with less options specified is relatively "safe" and you have to add extra syntax to make it "unsafe".
It was definitely a violation of:
https://en.wikipedia.org/wiki/Principle_of_least_astonishment https://en.wikipedia.org/wiki/Principle_of_least_astonishmen...
EDIT reply to: >The whole reason for mogrify's existence is that it overwrites the original image file.
Sure, I understand that but many other destructive tools will have safety UI features such as creating ".bak" backup files. That's what many other command line tools do including image utilities. So something like mogrify could have been designed with hypothetical syntax as "mogrify -nobackups". The principle is to type extra syntax to make it more dangerous while still accomplishing the (observable) goal of changing the original files.
[1] https://superuser.com/questions/1575004/imagemagick-how-to-avoid-overwriting-existing-files-with-mogrify https://superuser.com/questions/1575004/imagemagick-how-to-a...
- captn3m0 5y ago> mogrify - resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more. Mogrify overwrites the original image file, whereas, convert(1) writes to a different image file. The whole reason for mogrify's existence is that it overwrites the original image file.
- MontyCarloHall 5y agoIt would be much safer to take the sed approach and put mogrify‘s functionality under `convert -i[backup extension]`, and dispense with standalone mogrify altogether. Imagine having the command “sedd” aliased to `sed -i`. It would be a usability nightmare.
- linspace 5y ago> The whole reason for mogrify's existence is that it overwrites the original image file. Then it should not exist. To save one "rm", doesn't look like a good idea to me.
- rg111 5y ago> Then it should not exist. It definitely should. This becomed critical when you are doing batch processing large amount of images in a cloud instance or somewhere else where disk space is a constraint. I have used mogrify and similar custom solution when trying to batch-edit gigabytes of images while cleaning data for Computer Vision training.
- cozzyd 5y agowell, use convert instead. It's the only difference...