I found a high-res icon to use for my SlimTimer site-specific browser I created with Fluid. The icon almost fit in with all of the other beautiful icons in my dock, but not quite. The issue I had was the text that I couldn't quite read. So I decided to get rid of the text, and I figured it was a good chance to practice programatically editing images with PHP. I used a couple of examples, and the php docs and comments, to create this little bit of code that does exactly what I'd do in an image manipulation program -- pick the white color from the image (in case it isn't #ffffff) and draw a filled rectangle over the text I want to hide. It's a round-about way to go about it, but it helped me get comfortable with PHP's GD functions.
<?php
if ($_GET['img'] == 'slimtimer') {
$im = imageCreateFromPng('slimtimer.png');
imageAlphaBlending($im, true);
imageSaveAlpha($im, true);
$white = imagecolorat($im, 100, 200);
imagefilledrectangle($im, 100, 400, 450, 450, $white);
header('Content-Type: image/png');
imagePng($im);
imageDestroy($im);
}
?>
Original Image:
Image with text removed: