subImage($id * $charWidth, 0, $charWidth, $charHeight); } // Place four images in a box $out = Image::create(18, 17, Image::IMAGE_BLACK_WHITE); $out -> rect(0, 0, 18, 17); $out -> rect(3, 0, 12, 17, true, 0, 0); $out -> compose($subImages[0], 0, 0, 4, 1, $charWidth, $charHeight); $out -> compose($subImages[1], 0, 0, 10, 1, $charWidth, $charHeight); $out -> compose($subImages[2], 0, 0, 4, 9, $charWidth, $charHeight); $out -> compose($subImages[3], 0, 0, 10, 9, $charWidth, $charHeight); # Print output for debugging ;) echo $out -> toString(); $out -> write($outFile);