Imagemagick operators page: 2

Auto level

Automagically adjust color levels of image.

Auto level example
<?php 
$cmd 
"$input -auto-level"
exec("convert $cmd auto_level.jpg");
 
?>

Auto orient

Automagically orient (rotate) an image created by a digital camera.

Auto orient example
<?php 
$cmd 
"$input -auto-orient"
exec("convert $cmd auto_orient.jpg");
 
?>

( Will only work if the camera saves the oriantation to the EXIF data. )

Average

Average a set of images.

Average example
<?php 
$cmd 
"$input blue-shift.jpg auto_gamma.jpg -average"
exec("convert $cmd average.jpg");
 
?>

Backdrop

Display the image centered on a backdrop.

Not used with php.

Background

Background example
<?php 
$cmd 
"$input -background NavajoWhite "
"-shear 15x15 -resize 213x" 
exec("convert $cmd background.jpg");
 
?>

( Background sets the canvas colour and will be exposed when using other operators like rotate and shear. You can have a background of none which is transparent but the image must be saved as a gif or png. )

Bench

Measure performance.

Array ( [0] => Performance: 3i 0.158932ips

<?php 
$cmd 
"$input -resize 1000% -bench 3 "
exec("convert $cmd big.png 2>&1",  $output); 
print_r($output);
 
?>

( Repeat the entire command for the given number of iterations; report the user-time and elapsed time.
Modify the benchmark with the -duration to run the benchmark for a fixed number of seconds and -concurrent to run the benchmark in parallel (requires the OpenMP feature).
3 iterations were completed at 0.158932 iterations per second. )

Bias

Add bias when convolving an image.

Bias example
<?php 
$cmd 
"$input -convolve \"-1,0,1,-1,0,1,-1,0,1\" -bias 20% ";  
exec("convert $cmd bias.jpg"); 
  
?>

Black threshold

Black threshold example
<?php 
$cmd 
"$input -black-threshold 30%";  
exec("convert $cmd black_threshold.jpg");
 
?>

( Force to black all pixels below the threshold while leaving all pixels at or above the threshold unchanged. )

Blackpoint compensation

Blackpoint compensation for a colour profile.

More information to follow.

<?php 
$cmd 
"$input -intent relative -black-point-compensation".
" -profile CMYK_PROFILE ";
exec("convert $cmd black-point-compensation.jpg");
 
?>

Blend

Blend an image into another by the given percent.

Blend example
<?php 
$cmd 
"-size 213x160 xc:blue miff:- "
"| composite $input +swap -blend 70 - "
exec("convert $cmd blend.jpg");
   
?>

( This is creating the blue image to blend as well as blending the two images. *** should be able to define the size of the blue image from the size of the image *** )

Blue primary

Set the blue chromaticity primary point.

Blue primary example
<?php 
$cmd 
"$input -blue-primary 80,80";   
exec("convert $cmd blue-primary.jpg");
 
 
?>

Blue shift

Simulate a scene at nighttime in the moonlight. Start with a factor of 1.5

Blue shift example
<?php 
$cmd 
"$input -blue-shift 1.5 "
exec("convert $cmd blue-shift.jpg");
 
?>

Blur

Reduce image noise and reduce detail levels.

Blur example
Another Blur example
<?php 
$cmd 
"$input -blur 15"
exec("convert $cmd blur_simple.jpg");

$cmd "$input -blur 0x3"
exec("convert $cmd blur.jpg");
 
?>

Border

Surround the image with a border of color.

Border example
<?php 
$cmd 
"$input -bordercolor NavajoWhite "
"-border 10x10"
exec("convert $cmd border.jpg");
 
?>

( The border increases the size of the image by 2 x the width of the border. The top and bottom border size can be different to the left and right. )