Image arithmetics allow math operations to be done to 2 or more images. Here is a class does addition, subtraction, difference, average, min, max, multiplication, amplitude, AND, OR and XOR functions to 2 png images and out put the result.
This is the first release, version 0.1, very limited function indeed. It only can do arithmetic on RGB , which does not include transparency. There might be a update which make it support HSL and HSV.
I will show some example of what it can do
First, the original 2 images:

Each snippet start with
$cool = new image_rgb_arithmetic(50, 50); $cool->add_image('inputimage1.png'); $cool->add_image('inputimage2.png');
end with
$cool->output();
down here only list the operation between them.
Here is the result of each snippet:
Addition
$cool->image_sum();

Subtraction
$cool->image_sub();

Difference
$cool->image_difference();

Average
$cool->image_average();

Minimal
$cool->image_min();

Maximum
$cool->image_max();

Multiplication
$cool->image_product();

Amplitude
$cool->image_amplitude();

AND/OR/XOR
$cool->image_and();

$cool->image_or();

$cool->image_xor();

Comments
Post new comment