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 11

Level colors

Adjust the level of an image using the provided dash seperated colors.

Level colors example

$cmd = " $input -level-colors #2a3e0b,#ff5f79";
exec("convert $cmd level_colors.jpg");

Limit

Set the resource limit.

Limit example

$cmd = "$input -limit memory 200mb -motion-blur 0x8+30"; 
exec("convert $cmd limit.jpg");

Linear stretch

Linear with saturation stretch.

Linear stretch example

$cmd = "$input -linear-stretch 1,2% ";  
exec("convert $cmd linear_stretch.jpg");

Linewidth

Linewidth is depreciated use strokewidth.

Linewidth example

$cmd = "$input -stroke black -linewidth 5". 
" -fill none -draw \"circle 120,80 120,15 \" "; 
exec("convert $cmd linewidth.jpg");
 

Liquid rescale

Rescale image with seam-carving.

Liquid rescale example

$cmd = "$input -liquid-rescale \"75x100%\!\" "; 
exec("convert $cmd liquid_rescale.jpg");

( Not built in extra code needs to be built into IM. )

List

List some operator options

All the gravity options

None
Center
East
Forget
NorthEast
North
NorthWest
SouthEast
South
SouthWest
West
Static

echo "All the gravity options
"; 
system("convert -list gravity");  
echo "
";

Log

Specify the format for the debug log.

First few lines of output

$array = array(); 
echo "
";
$cmd = " -debug coder -log \"%u %m:%l %e\" $input ";
exec("convert $cmd log.jpg 2>&1", $array);  
echo "
".print_r($array)."
"; echo "
";

( Array ( [0] => 0.016u jpeg.c:336 [images/input.jpg] JPEG Trace: "Start of Image" [1] => 0.016u jpeg.c:336 [images/input.jpg] JPEG Trace: "JFIF APP0 marker: version 1.01, density 72x72 1" [2] => 0.016u jpeg.c:667 Profile: exif, 11764 bytes )

Loop

Add Netscape loop extension to your GIF animation.

Loop example

$cmd = " -dispose previous -delay 5 -size 213x160 xc:none -page +0+0 $input4". 
" -page +10+15 $input4 -page +20+30 $input4 -page +30+45 $input4". 
" -page +40+60 $input4 -page +50+75 $input4 -page +60+90 $input4". 
" -page +70+75 $input4 -page +80+60 $input4". 
" -page +90+45 $input4 -page +100+30 $input4 -page +110+15 $input4". 
" -page +120+0 $input4 -loop 0"; 
exec("convert $cmd loop.gif");
     

Lowlight color

When comparing images, de-emphasize pixel differences with this color.

More information to follow.

Magnify

magnify the image.

Not used with php

Map

Display image using a specified type.

More information to follow.


( Used with animations.
+map generate a colour map
-map use a colour map
)

Mask

Composite the image pixels as defined by the mask.

More information to follow.

Mattecolor

Sets the color for -frame

Mattecolor example

$cmd = "$input -mattecolor lightbrown -frame 10x10+0+0"; 
exec("convert $cmd mattecolor.jpg");
 

Median

Apply a median filter to the image.

Median example

$cmd = "$input -median 1"; 
exec("convert $cmd median.jpg");