Order of Operations

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
The Little Guy
Posts: 9
Joined: 2011-03-19T07:56:19-07:00
Authentication code: 8675308

Order of Operations

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Order of Operations

Post 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.
The Little Guy
Posts: 9
Joined: 2011-03-19T07:56:19-07:00
Authentication code: 8675308

Re: Order of Operations

Post by The Little Guy »

Okay, Thanks!

I will give that a try, and if I have any problems I will let you guys know!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Order of Operations

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply