Rubblewebs

THESE CODES ARE PROVIDED FOR AN EXAMPLE OF HOW TO USE IMAGEMAGICK WITH PHP. CARE SHOULD BE TAKEN WHEN ACCEPTING USER INPUT.

I TAKE NO RESPONSABILTY FOR ANY PROBLEMS THAT MAY OCCURE WHEN USING ANY OF THIS CODE.

IT IS UP TO YOU TO SECURE THE CODE AND VALIDATE USER INPUT.

Imagemagick operators page 20

Units

The units of image resolution.

Units example

$cmd = "$input -density 200x200".
" -units PixelsPerInch";  
exec("convert $cmd units.jpg");
 

Unsharp

Sharpen the image with an unsharp mask operator.

Unsharp example

$cmd = "$input -unsharp 1.5"; 
exec("convert $cmd unsharp_simple.jpg");

Update

Detect when image file is modified and redisplay.

Not used with php

Verbose

Print detailed information about the image when this option preceds the -identify option or info:

Image: input.jpg
Format: JPEG (Joint PhotographicExperts Group JFIF format)
Class: DirectClass
Geometry: 266x200+0+0
Resolution: 72x72
Print size: 3.69444x2.77778


system("convert $input -verbose -identify ");
 

( Will output an A4 size sheet of information about an image. )

Version

Print ImageMagick version.

Version: ImageMagick 6.7.3-6 2011-11-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC

Features: OpenMP

echo "
"; 
system("convert -version");   
echo "
";

( As we want the version displayed use system not exec. )

View

FlashPix viewing parameters.

Not used with php.

Vignette

soften the edges of the image in vignette style.

Vignette example

$cmd = "$input -background none -vignette 0x6"; 
exec("convert $cmd vignette.png");

Virtual pixel

Specify contents of virtual pixels.

More information to follow.

$cmd = "$input -matte -virtual-pixel NavajoWhite ". 
"-distort Perspective \"0,0 0,0  0,200 0,200 266,200 ". 
"266,180 266,0 266,20 \" "; 
exec("convert $cmd virtual_pixel.jpg");

Visual

Animate images using this X visual type.

Not used with php

Watermark

Watermark an image using the given percentages of brightness and saturation.

Watermark example

$cmd = "-watermark 100% -gravity center $input1 $input"; 
exec("composite $cmd watermark.jpg");

Wave

Shear the columns of an image into a sine wave.

Wave example

$cmd = "$input -background Blue -wave 50x100"; 
exec("convert $cmd wave.jpg");
 

Weight

Set a font weight for text.

Weight example

$cmd = "$input -fill black -pointsize 30 -weight Bold". 
" -gravity center -annotate +2+2 \"Weight\""; 
exec("convert $cmd weight.jpg");

White point

Chromaticity white point.

White point example

// Probably need to use with other operators
$cmd = "$input -white-point 0.4,0.4"; 
exec("convert $cmd white-point.jpg");

( The "x" and "y" have nothing to do with the x,y position of a pixel on the image. Instead, they are coordinates of the white pixel in the chromaticity diagram (see the color diagram on the right of the page at http://en.wikipedia.org/wiki/Chromaticity) )

White threshold

Force to white all pixels above the threshold while leaving all pixels at or below the threshold unchanged.

White threshold example

$cmd = "$input -white-threshold 50%";  
exec("convert $cmd white_threshold.jpg");