ImageInformation tempImageInformation = ImageReader.readImage(tempFile.getAbsolutePath());
if (tempImageInformation != null){
// draw the tile on the image.
Envelope tempTileEnvelope = myIndex.getWorldCoordinates(tempResolution, tempPoints[i].x, tempPoints[i].y);
tempWorldBuffer.expandToInclude(tempTileEnvelope);
int tempTileStartX = (int) (((tempTileEnvelope.getMinX() - inEnvelope.getMinX())/inEnvelope.getWidth()) * tempWidth);
int tempTileStartY = tempHeight - (int) (((tempTileEnvelope.getMinY() - inEnvelope.getMinY())/inEnvelope.getHeight()) * tempHeight);
int tempTileEndX = (int) (((tempTileEnvelope.getMaxX() - inEnvelope.getMinX())/inEnvelope.getWidth()) * tempWidth);
int tempTileEndY = tempHeight - (int) (((tempTileEnvelope.getMaxY() - inEnvelope.getMinY())/inEnvelope.getHeight()) * tempHeight);
if (i==0) {