Image Magick
We have ImageMagick installed on all our servers already! It's a great suite of little unix programs for letting you manipulate images in an automated fashion directly on our server! You'll need a shell account with us to use ImageMagick.
The path to ImageMagick is /usr/bin (the program usually used is actually called "convert", not imagemagick).
If you're using ImageMagick in php you have to run it as a php-cgi. All new domains at DreamHost are forced to run PHP as CGI as we no longer support mod_php, so this is no longer a concern.
Contents |
Parent Article
Online Image Manipulation with ImageMagic
Want a quick and easy way to change your image? Visit the ImageMagick studio:
http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi
At this site, you can upload images from your computer, a disk, or even your website, and change them on ImageMagick's own interactive website --- for free!
About Image Magick
ImageMagick is a free open-source program for creating and manipulating images in more than 68 formats (including GIF, JPEG, TIFF, PhotoCD, PDF, and PNG.) It runs on many popular operating systems including Linux, Unix, Windows (95/98 and 2000), MacIntosh, VMS, and OS2.
Once you have downloaded and installed ImageMagick on your computer, you can manipulate image files directly from the command line, or access the different manipulation methods through your favorite Perl, C, C++, or Java development environment.
Since ImageMagick creates images in most of the standard formats (and then some), feel free to use it to create images for your DreamHost site.
For more information about ImageMagick, go to their homepage:
Compiling ImageMagick on your DreamHost account
| The instructions provided in this article or section are considered advanced. You are expected to be knowledgeable in the UNIX shell. |
If you need ImageMagick features that are not found in the installed version (as of this writing yerba has version 6.3.0) compiling and installing it from source is a snap.
This will install ImageMagick into $HOME/local/bin
- 1) grab the source from http://imagemagick.org
~src$ wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
- 2) untar imagemagick into a src directory
~src$ tar zxvf <image_magick>.tar.gz
- 3) change to the imagemagick directory
~src$ cd ImageMagick<version>
- 4) configure and install
$ LDFLAGS="-L$HOME/local/lib -Wl,-rpath,$HOME/local/lib"
$ LD_LIBRARY_PATH=$HOME/local/lib
$ ./configure --prefix=$HOME/local --with-gslib --with-gs-font-dir=/usr/share/fonts/type1/gsfonts/ \
--with-perl-options=PREFIX=$HOME/perl
$ make
$ make install
In the case of '/usr/bin/ld: cannot find -lltdl' error try the previous version (would be great if anybody offer more reliable solution)
~src$ wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.7.9-10.tar.gz
and repeat all procedure again
RMagick Note: If you're only compiling for RMagick, you can skip the --with-perl-options option and use --without-perl --without-magick-plus-plus instead. You'll speed up the install and save on disk space.
GhostScript Note: currently (july 2008) GhostScript distribution on DreamHost servers is pretty old. If you intend to use ImageMagick's PDF features (eg. to convert content to images) you are encouraged to compile a newer version by yourself. You'll then have to set your shell PATH accordily to let ImageMagick's configure see your installation instead of the default one. Using an old GhostScript version can lead to problems with some PDF.
Other advanced options can be found at http://imagemagick.org/script/advanced-unix-installation.php.
Estimated Time
On zim, the ./configure operation took about 2-3 minutes to complete during mid-day, whereas the make operation took about 30 minutes to execute.
On phaeton, compiling for RMagick (skipping Perl and Magick++ options), configure took 2-3 minutes while make took roughly 15. Aupajo 01:57, 6 July 2008 (UTC)
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 . ">";
?>