ImageIO.write(img, imgtype, baos);
po.addPart(baos.toByteArray());
// write it to a file
// System.out.println("Write "+new File(directory, getFilename()).getAbsolutePath());
po.writeTo(new File(directory, getFilename()));
}
/**
* Creates an XML document from the current MapTile.
*