     } cleave ;
 
 : tiff>image ( image -- image )
-    ifds>> [ ifd>image ] map first ;
+    ifds>> values [ ifd>image ] map first ;
 
 : with-tiff-endianness ( loading-tiff quot -- )
     [ dup endianness>> ] dip with-endianness ; inline

    ] if ;

: process-tif-ifds ( loading-tiff -- )
    ifds>> [ process-ifd ] each ;

: load-tiff ( -- loading-tiff )
    load-tiff-ifds dup

! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs byte-arrays combinators
combinators.short-circuit compression.lzw endian fry grouping
images images.loader io io.binary io.encodings.ascii
io.encodings.string io.encodings.utf8 io.streams.throwing kernel
math math.bitwise math.vectors pack sequences ;
IN: images.tiff

SINGLETON: tiff-image

TUPLE: loading-tiff endianness the-answer ifd-offset ifd-offsets ifds ;

: <loading-tiff> ( -- tiff )
    loading-tiff new
        H{ } clone >>ifds ; inline

! offset, next-offset, and count are not strictly necessary here
! count is just the length of ifd-entries
TUPLE: ifd offset next-offset count
ifd-entries processed-tags strips bitmap ;

: <ifd> ( offset count ifd-entries next-offset -- ifd )
    ifd new
        swap >>next-offset
        swap >>ifd-entries
        swap >>count
        swap >>offset ;

TUPLE: ifd-entry tag type count offset/value ;

