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 16

Scene

Set scene number.

More information to follow.

/*
convert '*.jpg' -resize 256 -scene 1 image_%02d.jpg 
*/

( Resize all the jpg files in a folder and start saving them with the number 1 rather than the default of 0 )

Screen

Specify the screen to capture.

Not used with php

Script

Stop the processing of command line arguments as image operations, and read all further options from the given file or pipeline.

Another Script example

Seed

Seed a new sequence of pseudo-random numbers.

More information to follow.

Segment

Segment the colors of an image.

Segment example

$cmd = "$input -segment 60x0.5  ";
exec("convert $cmd segment.jpg");

Selective blur

Selectively blur pixels within a contrast threshold.

Selective blur example

$cmd = " $input -selective-blur 0x6+09% ";
exec("convert $cmd selective_blur.jpg");

Separate

Separate an image channel into a grayscale image.

Separate example

$cmd = " $input -channel RGB -separate "; 
exec ("convert $cmd separate.png");

( Specify the channel with -channel. )

Sepia tone

Sepia effect.

Sepia tone example

$cmd = "$input -sepia-tone \"80%\" "; 
exec("convert $cmd sepia-tone.jpg");

Set

Set an image attribute for all images in the current image sequence, after they have been created or read in.

More information to follow.

Shade

Shade the image using a distant light source.

Shade example

// Create the text
$cmd = "-size 215x68 xc:none -pointsize 25 -fill white ".
" -gravity northwest -annotate +15+10 Boots ".
" -gravity southeast -annotate +10+0 Boots -shade 240x40";
exec("convert $cmd tmp_font.png ");

// Create the gradiant
exec("convert -size 213x160 gradient:pink-red tmp_gradient.png");

// Put the text over the gradiant
exec("composite -watermark 40% -tile tmp_font.png tmp_gradient.png watermark.png"); 

// Put the image over the watermarked gradiant
exec("convert watermark.png $input1 -gravity center -composite shade.jpg");

Shadow

Simulate an image shadow.

Shadow example

$cmd = "$input ( +clone -background black -shadow 80x4+5+5 )". 
" +swap -background none -layers merge +repage "; 
exec("convert $cmd shadow.png");

( To retain the transparency of the shadow save as a png. )

Shared memory

Use shared memory.

Another Shared memory example

Sharpen

sharpen the image.

Sharpen example

$cmd = "$input -sharpen 5";  
exec("convert $cmd sharpen.jpg");
 

Shave

Shave pixels from the image edges.

Shave example

$cmd = "$input -shave 40x20"; 
exec("convert $cmd shave.jpg");