A few ImageMagic notes

ImageMagic is a collection of useful command line tools that  allows you to edit an image without using a heavyweight photo editing application like Photoshop or GIMP. This is great for batch processing a large volume of images. Here are a few tasks that I found useful for my own uses:

To rotate an image:

convert -rotate <degree> <src file> <target file>

To resize an image:

convert -geometry 800x600 <src file> <target file>

To add watermark:

composite -dissolve 50% -gravity SouthEast -geometry +5+5 <watermark file> <src file> <target file>

composite command deserves an additional comment. The -dissolve option defines how visible you want the watermark image to appear on your target image. -gravity option defines which side/corner you want to place the watermark in the target image. The choices are NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast -geometry option allows you to define offset values on the placement after applied -gravity option. In the command above, the input values will cause the watermark image to move 5 units (first +5) left of the right boarder and 5 units (second +5) above the bottom border. So there is a little bit of space between the boarder of the target image and the border of the watermark.

See official web site for more information.


4 thoughts on “A few ImageMagic notes

  1. Thanks for sharing your tip. The command line notes I wrote was really for use in a script, which will do something similar to Phatch. Phatch sounds like another good option for people to use.

  2. just started using ImageMgick and i am liking it a lot. but when i make a .bat file with my images on (3000+) the bat file doesnt execite properly (and no i cant use wildcards to list them)
    i think there is a built in line length in .bat files so i added a line return in the command using ^ character and for small numbers of files it works but large numbers of file it does not.

    do you know of a good way to use image magic on large numbers of files?

  3. Hi Dave,

    Sounds like you are using Windows. Have you tried Cygwin? I wonder if it will give you a better environment to write shell scripts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s