} else if (s.endsWith(".png")) {
JAI.create("filestore", getImage(), tmpFile, "PNG", new PNGEncodeParam.Gray());
} else if (s.endsWith(".pnm")) {
JAI.create("filestore", getImage(), tmpFile, "PNM", new PNMEncodeParam());
} else if (s.endsWith(".tiff") || s.endsWith(".tif")) {
JAI.create("filestore", getImage(), tmpFile, "TIFF", new TIFFEncodeParam());
} else if (s.endsWith(".bmp")) {
JAI.create("filestore", getDisplayImage(), tmpFile, "BMP", new BMPEncodeParam());
} else {
// assume FITS format
FITSImage fitsImage = getFitsImage();