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 19

Tile offset

Specify the offset for tile images, relative to the background image it is tiled on.

Tile offset example

exec("convert $input1 -thumbnail 50x50 temp.png");
// Tile the image
$cmd = " -size 213x160 -tile-offset +10+10 tile:temp.png ";  
exec("convert $cmd tile_offset.jpg"); 

( This is the offset from the datum position NOT the offset between the tiles. The default position is the top left corner. )

Tint

Tint the image with the fill color.

Tint example

$cmd = "$input -fill Blue -tint 30"; 
exec("convert $cmd tint.jpg");

Title

Assign a title to displayed image.

Not used with php

Transform

Transform the image.

This operator has been now been superseded by the -distort 'AffineProjection' method.

Transparent

Make this color transparent within the image.

Transparent example

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

( Save as a png to retain the transparency. -fuzz can be used to select a range of colours.
Also see Transparent inverted )

Transparent color

Set the transparent colour.

Transparent color example

$cmd = "$input -transparent-color Black"; 
exec("convert $cmd transparent_color.jpg");

( This does not make a colour transparent, it only defines what colour the transparent colour is in the colour palette of the saved image. )

Transparent inverted

Make all colours except this color transparent within the image.

Transparent inverted example

$cmd = "$input -fuzz 10% +transparent #7b1216 ";  
exec("convert $cmd plus_transparent.png"); 

( Save as a png to retain the transparency. -fuzz can be used to select a range of colours. )

Transpose

Mirror the image along the top-left to bottom-right diagonal.

Transpose example

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

Transverse

Mirror the image along the images bottom-left top-right diagonal.

Transverse example

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

Treedepth

Tree depth for the color reduction algorithm.

More information to follow.

Trim

Trim an image.

Trim example

$cmd = "strokewidth.jpg -trim "; 
exec("convert $cmd trim.png");

( -fuzz can be added if the the border colour varies slightly. )

Type

The image type.

Type example

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

( Choose from: Bilevel, Grayscale, GrayscaleMatte, Palette, PaletteMatte, TrueColor, TrueColorMatte, ColorSeparation, or ColorSeparationMatte. )

Undercolor

Set the color of the annotation bounding box.

Undercolor example

$cmd = "$input -fill Black -pointsize 40 -gravity center". 
" -undercolor NavajoWhite -annotate +0+0 \"Undercolor\""; 
exec("convert $cmd undercolor.jpg");

Unique colors

Discard all but one of any pixel color from the image.

Unique colors example

$cmd = "$input4 -unique-colors -resize x20"; 
exec("convert $cmd unique_colors.jpg");

( Will create an image 1px high and VERY wide if your image contains a lot of colours. I have resized the height to 20px to see the colours. )