Colorize - a PHP class to swap color in images

Colorize is a simple PHP class that allows you to supply template / source images and easily replace color(s) in them and save them as copies. It could be useful if you are building a theme generator for a site or framework. Or if you have to replace the same colors in images with another color.

Check out the GitHub repo

Colorize has a simple setup, it goes as follows

<?php

require_once 'colorize.php';
//new instance with src images
$c =  new colorize(array(
    'src/red_arrow.png',
    'src/red_star.png'

));
//replace colors in the source
$c->replace(
    array('ED1C24', '000', 'e8d3d5'),
    array('7ADC4B', '4A4A4A'),
    'green'
);
?>

Just supply the source / template images and tell it what colors to replace. And it will save them in the cache dir