for (int row = 0; row < length; row += tileLength) {
for (int col = 0; col < width; col += tileWidth) {
if (!isTiled)
rows = Math.min(tileLength, length - row);
rect.setRect(minX + col, minY + row, cols, rows);
int tileSize = codec.encode(im, rect, bpixels);
out.write(bpixels, 0, tileSize);
stripTileOffsets[i] = currentOffset;
stripTileByteCounts[i++] = tileSize;
currentOffset += tileSize;
total += tileSize;