This PHP function uses the GD library to invert color or black and white images.
You can choose wether you want to save the negative of the image or just display it.
choose color or black and white output - works with .jpg and .png images if your GD-Library supports it.

download options for image editing / invert image

you can download the source as PHP file,

open the file as plain text in a new window or

get the code in a textarea to copy it.