Invalid image uploaded. Please go back and try again.'); } $imagepath = $_FILES['image']['tmp_name']; // Load image $image = open_image($imagepath); if ($image == false) { die ('You uploaded an invalid image. Please go back and try again.'); } // Check background color if (!isset($_POST['R']) || !isset($_POST['G']) || !isset($_POST['B'])){ die ('Please fill out all background fields.'); } if (!is_numeric($_POST['R']) || !is_numeric($_POST['G']) || !is_numeric($_POST['B'])){ die ('Please only put numbers in the background fields.'); } if ($_POST['R']<0 || $_POST['R']>255 || $_POST['G']<0 || $_POST['G']>255 || $_POST['B']<0 || $_POST['B']>255){ die ('One of your color settings is invalid. Please go back and try again.'); } // Set background variables $tr=$_POST['R']; $tg=$_POST['G']; $tb=$_POST['B']; // Create white for drawing spacing line $white = imagecolorallocate($image, 255, 255, 255); // Get original width and height $width = imagesx($image); $height = imagesy($image); for ($i=0;$i<$width;$i++){ for ($j=2;$j<$height;$j++){ $rgb = imagecolorat($image, $i, $j); $cols = imagecolorsforindex($image, $rgb); $r = $cols['red']; $g = $cols['green']; $b = $cols['blue']; if ($tr!=$r || $tg!=$g || $tb!=$b){ imagesetpixel($image, $i, 0, $white); continue 2; } } } // Display resized image header('Content-type: image/png'); imagepng($image); die(); } // Display the upload form: ?> FBA The Creator GFX Font Spacing Creator

FBA The Creator GFX Font Spacing Creator

FBA The Creator allows developers use their own bitmapped fonts, but creating them can be tedious. To that end, this tool removes most of the tedium by automatically creating the line that denotes spacing for a gfx font file.

The tool will accept either GIFs or PNGs. The Background fields refer to (r,g,b) values of the color you've used in your font file for transparency. The gfx file needs to be set up as normal with the top line filled with the background color. In other words, this will only create the spacing line, not correct it. The image shown gives an example of how to set up your file. What you'll get is an image in your browser than you can copy into your favorite graphics software to save and use in your project. (NOTE: Do not try to save the file; all you'll get is the source to the page.)

GFX Font Example

To download the source code for this tool, and for other neat things, visit www.phrebh.com.


Image:
Background: R:   G:   B: