Question

I'm fairly new to ImageMagick.

I wrote the following command to 1) scale an image, 2) resize the canvas with transparent space, 3) place the scaled image at the bottom of the canvas, 4) save the result over the original file.

convert TreeTest.png -resize 144x216 -background none -gravity South -extent 192x288 -set filename:output %t.%e %[filename:output]

It works! And does exactly what I wanted (after 15-20 minutes of looking up the documentation for the different commands).

What confuses me is that a seemingly equivalent command using 'mogrify' instead of 'convert' has no discernable results.

Here's the mogrify command I'm trying to use:

mogrify TreeTest.png -resize 144x216 -background none -gravity South -extent 192x288

The result is, as far as I can tell, no change to the image. I get zero error messages or warnings (making it seem like the command executed correctly), but the image is the exact same as before.

What am I doing wrong?

Was it helpful?

Solution

I figured out the problem. For others encountering the same thing, here's the solution:

The filename ("TreeTest.png") needs to go at the end of the mogrify command to function properly. From man page:

 mogrify [options] input-file

This command works as expected:

mogrify -resize 144x216 -background none -gravity South -extent 192x288 TreeTest.png

(The only difference is 'TreeTest.png' was moved to the end of the command)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top