anchor.diff:                              (,+lzw-compression+ . "LZW")))))))))
   
   (defun image-info (stream ifd)
  -  (declare (optimize (debug 2)))
     (let ((rows-per-strip (get-ifd-value 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+))
  
positive.code:                           (16
                             (error "Not yet!"))))))))))))))
  
  (defclass tiff-image ()
    ((length :accessor tiff-image-length :initarg :length)
     (width :accessor tiff-image-width :initarg :width)
     (bits-per-sample :accessor tiff-image-bits-per-sample :initarg :bits-per-sample)
     (samples-per-pixel :accessor tiff-image-samples-per-pixel :initarg :samples-per-pixel)
     (data :accessor tiff-image-data :initarg :data)))
  
  (defun read-rgb-image (stream ifd)
    (declare (optimize (debug 2)))
    (let ((image-width (get-ifd-value ifd +image-width-tag+))
          (image-length (get-ifd-value ifd +image-length-tag+))
          (samples-per-pixel (get-ifd-value ifd +samples-per-pixel-tag+))
          (bits-per-sample (get-ifd-values ifd +bits-per-sample-tag+))
          (rows-per-strip (get-ifd-value 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+))
          (compression (get-ifd-value ifd +compression-tag+))
          (planar-configuration (get-ifd-value ifd +planar-configuration-tag+))
          (predictor (get-ifd-value ifd +predictor-tag+)))
      (declare (ignore planar-configuration))
      ;; FIXME
      ;; 1. we need to support predictorsfor lzw encoded images.
      ;; 2. Presumably we'll want planar images as well at some point.
      (let* ((bytes-per-pixel
              (* samples-per-pixel
  
negative.code:       (list (car values))
        (array (elt values 0)))))
  
  (defclass tiff-image ()
    ((length :accessor tiff-image-length :initarg :length)
     (width :accessor tiff-image-width :initarg :width)
     (bits-per-sample :accessor tiff-image-bits-per-sample :initarg :bits-per-sample)
     (samples-per-pixel :accessor tiff-image-samples-per-pixel :initarg :samples-per-pixel)
     (data :accessor tiff-image-data :initarg :data)))
  
  (defun read-grayscale-strip (stream
                               array
                               start-row
                               strip-offset
                               strip-byte-count
                               width
                               compression)
    (file-position stream strip-offset)
    (ecase compression
      (1
       (let ((strip-length (/ strip-byte-count width))
             ;; FIXME: bytes-per-sample will need to change for 1- or
             ;; 4-bit images!
             (bytes-per-pixel 1))
         (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 
                   (setf (aref array (+ rowoff j))
                         (read-byte stream)))))))
      (#.+packbits-compression+
       (error "Not yet!")
       #+nil
       (let ((packed-bits (read-bytes stream strip-byte-count)))
         (let ((decoded (packbits-decode packed-bits))
               (decoded-offset 0))
           (let ((strip-length (/ (length decoded) width samples-per-pixel))
                 (bytes-per-sample (/ bytes-per-pixel samples-per-pixel)))
             (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)))
                                   (aref decoded decoded-offset))
                             (incf decoded-offset))
                            (16
                             (error "Not yet!"))))))))))))))
  
  (defun read-grayscale-image (stream ifd)
    (let ((image-width (get-ifd-value ifd +image-width-tag+))
          (image-length (get-ifd-value ifd +image-length-tag+))
          (bits-per-sample (or (get-ifd-value ifd +bits-per-sample-tag+) 1))
          (compression (get-ifd-value ifd +compression-tag+))
          (photometric-interpretation (get-ifd-value ifd +photometric-interpretation-tag+))
          (strip-offsets (ensure-vector (get-ifd-values ifd +strip-offsets-tag+)))
          (rows-per-strip (get-ifd-value ifd +rows-per-strip-tag+))
          (strip-byte-counts (ensure-vector (get-ifd-values ifd +strip-byte-counts-tag+))))
      (declare (ignore photometric-interpretation))
      (unless (eql bits-per-sample 8)
        (error "I can only read 8-bit grayscale images at the moment."))
      (let* ((bytes-per-pixel 1)
             (data (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-grayscale-strip stream
                                    data
                                    row-offset
                                    strip-offset
                                    strip-byte-count
                                    image-width
                                    compression))
        (make-instance 'tiff-image
                       :length image-length
                       :width image-width
                       :bits-per-sample bits-per-sample
                       :samples-per-pixel 1
                       :data data))))
  
  (defun read-rgb-strip (stream
                         array
  