First release of image rgb arithmetic class

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:
Input Image 1 Input Image 2
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();

Image Sum

Subtraction

$cool->image_sub();

Image Sub

Difference

$cool->image_difference();

Image Difference

Average

$cool->image_average();

Image Average

Minimal

$cool->image_min();

Image Minimal

Maximum

$cool->image_max();

Image Maximum

Multiplication

$cool->image_product();

Image Multiplication

Amplitude

$cool->image_amplitude();

Image Amplitude

AND/OR/XOR

$cool->image_and();

Image AND

$cool->image_or();

Image OR

$cool->image_xor();

Image XOR

Image Arithmetic Class

Post new comment

The content of this field is kept private and will not be shown publicly.
If you have a Gravatar account, used to display your avatar. If you have a Gravatar account, used to display your avatar.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <span> <fn>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • Use [fn]...[/fn] (or <fn>...</fn>) to insert automatically numbered footnotes.

More information about formatting options

What is 28 + 27?
To combat spam, please solve the math question above.
Honey Pot that kill bots