*** stiff.c	Sat Aug 12 17:10:51 2000
--- ../../../sane-1.0.3/frontend/stiff.c	Fri Nov 17 08:08:57 2000
***************
*** 366,372 ****
  
      /* the following values must be known in advance */
      ntags = 13;
!     data_size = 3*2 + 3*2;
      if (resolution > 0)
      {
          ntags += 3;
--- 366,374 ----
  
      /* the following values must be known in advance */
      ntags = 13;
! 
!     /* Strip Offset, min and max sample value need 3 values per entry */
!     data_size = 3 * (3*2);
      if (resolution > 0)
      {
          ntags += 3;
***************
*** 385,392 ****
      /* image length */
      add_ifd_entry (ifd, 257, (height > 0xffff) ? IFDE_TYP_LONG : IFDE_TYP_SHORT,
                     1, height);
!     /* bits per sample */
!     add_ifd_entry (ifd, 258, IFDE_TYP_SHORT, 1, depth);
      /* compression (uncompressed) */
      add_ifd_entry (ifd, 259, IFDE_TYP_SHORT, 1, 1);
      /* photometric interpretation */
--- 387,399 ----
      /* image length */
      add_ifd_entry (ifd, 257, (height > 0xffff) ? IFDE_TYP_LONG : IFDE_TYP_SHORT,
                     1, height);
! 
!     /* bits per sample: for RGB (photometric = 2) we have to specify 1 value
!      * for each sample (see TIFF6.0 Spec)
!      */
!     add_ifd_entry (ifd, 258, IFDE_TYP_SHORT, 3, data_offset);
!     data_offset += 3*2;
! 
      /* compression (uncompressed) */
      add_ifd_entry (ifd, 259, IFDE_TYP_SHORT, 1, 1);
      /* photometric interpretation */
***************
*** 434,439 ****
--- 441,451 ----
      }
  
      write_ifd (fptr, ifd, motorola);
+ 
+     /* Write bits per sample */
+     write_i2 (fptr, depth, motorola);
+     write_i2 (fptr, depth, motorola);
+     write_i2 (fptr, depth, motorola);
  
      /* Write min sample value values */
      write_i2 (fptr, 0, motorola);
