I'm trying to save a byte[] of raw image data to a .tiff file on my harddrive with the help of the Java Advanced Imaging API. There are some minor examples on the web but they didn't help me really because they don't match my exact problem.
I already managed to save the data from the byte[] to a .raw and can view the result with success so the source actually contains some data. The method in question is executable without any exceptions but all I get is a black image whenever I view it with the Windows XP ImageViewer.
This is my method:
public void saveTif(byte[] imgData) {
BufferedImage bufferedImage = new BufferedImage( 1280, 1024, BufferedImage.TYPE_BYTE_GRAY );
bufferedImage.createGraphics().drawBytes(imgData, 0, 1280*1024, 0, 0);
TIFFEncodeParam params = new TIFFEncodeParam();
params.setCompression( TIFFEncodeParam.COMPRESSION_NONE );
String filenametiff = path + File.separatorChar + new SimpleDateFormat("dd_MM_yyyy_HH_mm_ss'.tiff'").format(new Date());
JAI.create("filestore", bufferedImage, filenametiff, "TIFF", params);
}