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AAAABAAAACAESAAMAAAABAAEAAAEVAAMAAAABAAMAAAEWAAMAAAABAAwAAAEXAAQAAAAB
AAACQAEaAAUAAAABAAAC/AEbAAUAAAABAAADBAEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAAA
AAAACAAIAAgSwAAAAAQAABLAAAAABAAA}

test tiff-1.1 {} {
    catch {image delete i}
    image create photo i -file folder.tif
} i
test tiff-1.2 {} {
    catch {image delete i}
    image create photo i
    i put $tiffdata
    i data -format {tiff -byteorder bigendian}
} $tiffdata
test tiff-1.3 {} {
    i blank
    i put $tiffdata -format tiff
    i data -format {tiff -byteorder bigendian}
} $tiffdata

if {[info tclversion] < 8.0} {
    return
}

test tiff-2.0 {Binary I/O with TIFF images} {
    i blank
    set f [open folder.tif r]
    fconfigure $f -translation binary
    set return [catch {i put [read $f]} msg]
    close $f
    lappend return $msg
} {0 {}}

