Image Magick

From DreamHost

Jump to: navigation, search

More at ImageMagick.org

At Dreamhost ImageMagick command-line utilities are found under /usr/bin/.

DESCRIPTION ImageMagick provides a suite of command-line utilities for creating, converting, editing, and displaying images:

display is a machine architecture independent image processing and display facility. It can display an image on any workstation display running an X server.

import reads an image from any visible window on an X server and outputs it as an image file. You can capture a single window, the entire screen, or any rectangular portion of the screen.

montage creates a composite by combining several separate images. The images are tiled on the composite image with the name of the image optionally appearing just below the individual tile.

convert converts an input file using one image format to an output file with the same or differing image format while applying an arbitrary number of image transformations.

mogrify transforms an image or a sequence of images. These transforms include image scaling, image rotation, color reduction, and others. The transmogrified image overwrites the original image.

identify describes the format and characteristics of one or more image files. It will also report if an image is incomplete or corrupt.

composite composites images (blends or merges images together) to create new images.

compare compare an image to a reconstructed image.

conjure interprets and executes scripts in the Magick Scripting Language (MSL).

PHP Example

This example uses PHP to create a thumbnail and display it. The original file is called glass.jpg and the thumbnail is called glass.png and is then displayed in the browser at 150 pixels wide. This PHP script must be in the same directory as your image. To use a different name, enter it after $name. $extfrm is the extention of the file that is being read and $extto is the extension of the file being created. The period that is required between filename and extension can be placed either in $name or both extension strings. Also, $convert and $output shows two different ways to combine strings. $command is where you can change the commands that convert excepts. Silkrooster 18:33, 25 Feb 2006 (PST)

   <?php
       $location='/usr/bin/convert';
       $command='-thumbnail 150';
       $name='glass.';
       $extfrm='jpg';
       $extto='png';
       $output="{$name}{$extto}";
       $convert=$location . ' ' .$command . ' ' . $name . $extfrm . ' ' . $name . $extto;
       exec ($convert);
       print "<img src=" . $output . ">";
   ?>
Personal tools