anchor.diff:        (unless (= tiff-magic 42)
           (error "Error reading TIFF file. ~S is not 42." tiff-magic)))
       (let ((ifds (read-ifds stream)))
  -      ifds)))
  +      (let ((ifd (car ifds)))
  +        (read-image stream ifd)))))
   
   (defun read-tiff-file (pathname)
     (with-open-file (stream pathname :direction :input :element-type :default)
  -    (read-tiff-stream stream)))+    (read-tiff-stream stream)))
  +
  +(defun write-tiff-stream (stream image)
  +  (declare (ignore stream image))
  +  (error "Not yet!"))
  +
  +(defun write-tiff-file (pathname image)
  +  (with-open-file (stream pathname :direction :output :element-type :default)
  +    (write-tiff-stream stream image)))
  
positive.code:     (read-sequence buf stream)
      buf))
  
  (defun read-int-16 (stream)
    (let ((bytes (read-bytes stream 2)))
      (ecase *byte-order*
        ((:big-endian nil) (+ (ash (aref bytes 0) 8) (aref bytes 1)))
        (:little-endian (+ (ash (aref bytes 1) 8) (aref bytes 0))))))
  
  (defun read-int-32 (stream)
    (let ((bytes (read-bytes stream 4)))
  
negative.code:        (progn
           (file-position stream ifd)
           (read-ifd stream))))
  
  (defun get-ifd-values (ifd key)
    (let ((field (find key ifd :key 'car :test '=)))
      (ifd-entry-values field)))
  
  (defun read-grayscale-image (stream ifd photometric-interpretation)
    (declare (ignore ifd photometric-interpretation))
    (error "Not yet!"))
  
  (defun read-strip (stream
                     array
                     start-row
                     strip-offset
                     strip-byte-count
                     width
                     bits-per-sample
                     samples-per-pixel
                     bytes-per-pixel)
    (let ((strip-length (/ strip-byte-count width samples-per-pixel))
          (bytes-per-sample (/ bytes-per-pixel samples-per-pixel)))
      (file-position stream strip-offset)
      (print (cons start-row strip-length))
      (loop for i from start-row below (+ start-row strip-length)
         do
           (let ((rowoff (* i width bytes-per-pixel)))
             (loop for j below width
                do 
                  (let ((pixoff (+ rowoff (* bytes-per-pixel j))))
                    (loop for k below samples-per-pixel
                       for bits across bits-per-sample
                       do 
                         (case bits
                           (8 
                            (setf (aref array (+ pixoff (* k bytes-per-sample)))
                                  (read-byte stream)))
                           (16
                            (error "Not yet!"))))))))))
  
  (defun read-rgb-image (stream ifd)
    (let ((image-width (car (get-ifd-values ifd +image-width-tag+)))
          (image-length (car (get-ifd-values ifd +image-length-tag+)))
          (samples-per-pixel (car (get-ifd-values ifd +samples-per-pixel-tag+)))
          (bits-per-sample (get-ifd-values ifd +bits-per-sample-tag+))
          (rows-per-strip (car (get-ifd-values ifd +rows-per-strip-tag+)))
          (strip-offsets (get-ifd-values ifd +strip-offsets-tag+))
          (strip-byte-counts (get-ifd-values ifd +strip-byte-counts-tag+)))
      (let* ((bytes-per-pixel
              (* samples-per-pixel (1+ (ash (1- (apply #'max (map 'list #'identity bits-per-sample))) -3))))
             (image (make-array (* image-width image-length bytes-per-pixel))))
        (loop for strip-offset across strip-offsets
           for strip-byte-count across strip-byte-counts
           for row-offset = 0 then (+ row-offset rows-per-strip)
           do (read-strip stream
                          image
                          row-offset
                          strip-offset
                          strip-byte-count
                          image-width
                          bits-per-sample
                          samples-per-pixel
                          bytes-per-pixel))
        (list image-length image-width samples-per-pixel image))))
  
  (defun read-image (stream ifd)
    (let ((photometric-interpretation (car (get-ifd-values ifd +photometric-interpretation-tag+))))
      (ecase photometric-interpretation
        ((0 1) (read-grayscale-image stream ifd photometric-interpretation))
        (2 (read-rgb-image stream ifd)))))
  
  (defun read-tiff-stream (stream)
    (let ((*byte-order*))
  