You are here

ImageMagick

Error message

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in drupal_strip_dangerous_protocols() (line 1458 of /home2/crephoto/public_html/techblog/includes/common.inc).

ImageMagick seems to be one of the most widely supported image manipulation packages available on linux-based web services. ImageMagick is primarily has an API for server-side web scripts, but I tend to use it from the command line when fixing borked images during the development stages of a web site. Because it is such a powerful application suite, I can never remember the basic syntax. Here are the most common uses I have on a day to day basis:

Get Image Properties

The most common thing I need to do is determine the pixel dimensions of an image. The following command will do just that.

convert -identify -verbose [input_file] null:

Substitute a valid image file name for [input_file]. Note that if you don't include the "null:" specification, you will receive an error message.

Resize an Image

For web sites that use screen-sized or thumbnail images, I often need to scale down an image. Here's how:

convert -resize [width]x[height] [input_file] [output_file]

Substitute the pixel width and height, and appropriate input and output files. Remember that this barely scratches the surface. ImageMagick can do so much more, you should really look into it.