Page 1 of 1

Order of Operations

Posted: 2011-08-23T09:12:58-07:00
by The Little Guy
how do I know what order ImageMagick will perform the tasks? I would like to resize an image, then crop it to make a thumb and make it a jpg.

So will ImageMagick perform the tasks in the order that was given to it, or will it perform the tasks in any order it chooses? What I need is for it to resize first, and crop second.

Code: Select all

convert /home/ryannaddy/img1.gmserver.net/inGame/original/Starcraft-II1.jpg -resize 120 -crop 120x76+0+0 /home/ryannaddy/img1.gmserver.net/inGame/102x/Starcraft-II1.jpg
Will the above do just that?

Re: Order of Operations

Posted: 2011-08-23T09:57:06-07:00
by fmw42
IM generally does the operations (other than settings) in order (left to right in the command line). So resize then crop will happen in that order. Your command should work as desired.

Re: Order of Operations

Posted: 2011-08-23T10:09:28-07:00
by The Little Guy
Okay, Thanks!

I will give that a try, and if I have any problems I will let you guys know!

Re: Order of Operations

Posted: 2011-08-23T16:37:33-07:00
by anthony
Actually settings are applied in order too, but as settings only gets stored you don't see much effect.

The only real exception to setting order is caused by legacy handling (for IMv5 compatibility) which ensures an image is read in before the first operation is applied.

IMv7 will be providing a true 'do it in order given' handling, which includes image reads. As such applying an operation when no image has been read will be an error (though a operational switch may be provided to ignore 'operation on no image' errors).
In that command, IMv5 legacy handling will not be provided for.