using php and imagemagick
by justin silverton
What is imagemagick and why do i need it?
image magick is a free and useful tool that can do the following:
1) Convert an image from one format to another (e.g. PNG to JPEG
2) Resize, rotate, sharpen, color reduce, or add special effects to an image
3) Create a montage of image thumbnails
4) Create a transparent image suitable for use on the Web
5) Turn a group of images into a GIF animation sequence
6) Create a composite image by combining several separate image
7) Draw shapes or text on an image
8) Decorate an image with a border or frame
9) Describe the format and characteristics of an image
Accessing it from PHP
In my experience, image magick is most likely installed here (on *nix systems) (it also may be in a different area on your system) : /usr/bin/convert
as an example of how I used it, I needed to automatically create thumbnails of images that were being uploaded through and administrative interface for a photo gallery.
exec (”/usr/local/bin/convert -geometry 480X -quality 70 $sourcepath $destpath”);
?>
notes: change /usr/local/bin to the directory on your system where it is installed.
$sourcepath: source image we want to convert (including image name)
$destpath: destination image name (including image name)
command line options
-adjoin join images into a single multi-image file
-affine matrix drawing transform matrix
-antialias remove pixel-aliasing
-append append an image sequence
-average average an image sequence
-background color background color
-blur geometry blur the image
-border geometry surround image with a border of color
-bordercolor color border color
-box color color for annotation bounding box
-cache threshold megabytes of memory available to the pixel cache
-gaussian geometry gaussian blur an image
-geometry geometry perferred size or location of the image
a full list can be found by executing convert –?
Download
Don’t have imagemagick on your system? download it for free Here
It’s free and licensed under the GNU
No comments yet. Be the first.
Leave a reply





