title: How to create a TIFF file from TIFF image data
body: <p>I have got several files that contains a specific header follows by TIFF image data.
  How can I write those TIFF image data into a TIFF file ?
  Thanks for your help.</p>
  
  <p>EDIT : Here's what I tested :</p>
  
  <pre><code>InputStream is = new FileInputStream(filePath);
  is.skip(252);
  BufferedImage bufferedImage = ImageIO.read(is);
  File fileOut = new File(fileOutPath);
  ImageIO.write(bufferedImage,"TIFF", fileOut);
  </code></pre>
  
  <p>I skip the specific header of the file (252Bytes) to get the Tiff Image data bytes.
  But the bufferedImage is null so I get a java.lang.IllegalArgumentException: im == null! exception.</p>
  
  <p>In resume, I have a TIFF file without a TIFF header. The TIFF header has been replace by a specific one but the image bytes are exactly the same as in a TIFF file.</p>
  
  <p>EDIT :
  Thanks to haraldK, I can finally create a TIFF header. But I can't open the image, maybe it is because of the compression : "M2 = Modified Read Code II (MRII), i.e., fax group 4". </p>
  
  <p>Here is the header that I created :</p>
  
  <pre><code>SubFileType (1 Long): Zero
  ImageWidth (1 Long): 210
  ImageLength (1 Long): 297
  BitsPerSample (3 Short): 8, 8, 8
  Compression (1 Short): Group 4 Fax (aka CCITT FAX4)
  Photometric (1 Short): RGB
  StripOffsets (1 Long): 306
  SamplesPerPixel (1 Short): 3
  RowsPerStrip (1 Short): 297
  StripByteCounts (1 Long): 187110
  ResolutionUnit (1 Short): None
  XResolution (72 Rational): 
  YResolution (1 Rational): Unexpected numeric
  DateTime (20 ASCII): 2014:07:12 10:51:51 
  Software (28 ASCII): Put your software name here 
  ImageDescription (30 ASCII): Put an image description here 
  </code></pre>
  
  <p>Should I uncompress the image data before merging the header and the image data ?</p>