$line){ $row = explode(" ", $line); if((count($row) == 5) // Valid row && ($row[0] != "~") // Tilde is the fudge character, if it's not sure what's in the box && ($minwidth <= ($row[3]-$row[1])) && ($maxwidth >= ($row[3]-$row[1])) && ($minheight <= ($row[4]-$row[2])) && ($maxheight >= ($row[4]-$row[2]))){ $cleanedboxes .= "$line\n"; imagerectangle($img, $row[1], ($img_height-$row[2]), $row[3], ($img_height-$row[4]), $colors[$index%3]); } } //Save the image as a png imagepng($img, $box_png); imagedestroy($img) ?>

Image file:
Box file:
Min width:
Max width:
Min height:
Max height: