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 8

Features

Display (cooccurrence matrix) texture measure features for each channel in the image in each of four directions (horizontal, vertical, left and right diagonals) for the specified distance.

Another Features example


( Used with identify )

FFT

Implements the forward discrete Fourier transform (DFT).

FFT example

$cmd = "$input3 -fft "; 
exec("convert $cmd fft.png");

( Uncompressed image formats only. )

Fill

Color to use when filling a graphic primitive.

Fill example

$cmd = "$input -fill blue -fuzz \"10%\"". 
" -opaque \"#7b1216\" "; 
exec("convert $cmd fill.jpg");

Filter

Filter to be used during resize.

Check this page for some examples of the filters


( The standard filter is Lanczos. )

Flatten

This is a simple alias for the -layers method "flatten".

Flatten example

$cmd = "-size 213x160 -background NavajoWhite -fill black". 
" -gravity center caption:\"Flatten\" -flatten"; 
exec("convert $cmd flatten.jpg");

Flip

Create a mirror image.

Flip example

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

Floodfill

Floodfill the image with color at the specified offset.

Floodfill example

$cmd = "$input -fill Blue -fuzz \"25%\" -floodfill +80+30 ". 
" \"#7b1216\""; 
exec("convert $cmd floodfill.jpg");

( Using -fuzz to floodfill pixels which only change by a small amount. )

Flop

Reflect the image in the horizontal direction.

Flop example

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

Font

Set the font to be used with draw, annotate etc.

Font example

$cmd = "$input -font handsean.ttf -pointsize 40 ". 
"-fill white -gravity south -annotate 0,0 \"Draw text\" "; 
exec("convert $cmd font.jpg");

( You can use a font recognised by Imagemagick or provide the path to a font. )

Foreground

Define the foreground color.

Not used with php.

Format

Output formatted image characteristics.

Format example

$time_stamp = exec("identify -format \"%[EXIF:DateTime]\" $input"); 
$cmd = "$input -pointsize 18 -gravity north ". 
" -fill black -annotate +2+2 \"Date: $time_stamp\"  ". 
" -fill white -annotate +0+0 \"Date: $time_stamp\"  "; 
exec("convert $cmd format.jpg"); 

$pi = exec("convert null: -format \"PI=%[fx:atan(1)*4]\" info:"); 
echo $pi;
// Result - PI=3.14159

Frame

A frame around the image

Frame example

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

( Set the frame color with -mattecolor. The image size will increase by the frame size. )

Function

Apply a function to channel values.

Function example

$cmd = "$input -channel R -function Sinusoid 3,-90,.2,.7"; 
exec("convert $cmd Sinusoid.jpg");

( Add another example http://www.imagemagick.org/Usage/color/#curves )

Fuzz

Fuzz can be used to select a range of colours and in the example is used with transparent.

Fuzz example

$cmd = "$input -fuzz 15% -transparent \"#7b1216\" "; 
exec("convert $cmd fuzz.png");

( Image displayed on a grey checkerboard to show the transparent areas.
IS IT ? )