Here's the script for future use :
if ( !preg_match("/[3-6]/",$pg) ) $pg=3; # 3,4,5,6
$Image="images/ppg_".$pg.".jpg";
Header("Content-type: image/jpeg");
$im=($Image) ? imagecreatefromjpeg($Image) : imagecreatetruecolor(143,191); # 143x191
define("WHITE",ImageColorAllocate($im, 0xFF,0xFF,0xFF));
define("BLACK",ImageColorAllocate($im, 0x0,0x0,0x0));
define("tColor",ImageColorAllocate($im, 0x99,0x33,0xCC)); ##9933CC
$fgColor=tColor;
if ($color) {
$red=hexdec(substr($color,0,2));
$green=hexdec(substr($color,2,2));
$blue=hexdec(substr($color,4,2));
$fgColor=ImageColorAllocate($im, $red,$green,$blue);
}
imagelayereffect($im,IMG_EFFECT_OVERLAY);
imagefilledrectangle($im,0,0,142,190,$fgColor);
imagejpeg($im,'',80);
imagedestroy($im);