Skip to content

Commit

Permalink
use STRIP[OFFSETS/BYTECOUNTS] if TILE[OFFSETS/BYTECOUNTS] not availab…
Browse files Browse the repository at this point in the history
…le (tlnagy#141)

fixes tlnagy#140
  • Loading branch information
chrstphrbrns authored Jan 3, 2024
1 parent 6ff5952 commit 79d5508
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ifds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ Base.read!(tfs::TiffFileStrip, arr::AbstractArray) = read!(tfs.io, arr)
Base.bytesavailable(tfs::TiffFileStrip) = bytesavailable(tfs.io)

function Base.read!(target::AbstractArray{T, N}, tf::TiffFile{O, S}, ifd::IFD{O}) where {T, N, O, S}
offsets = istiled(ifd) ? ifd[TILEOFFSETS].data : ifd[STRIPOFFSETS].data
offsets = TILEOFFSETS in ifd ? ifd[TILEOFFSETS].data : ifd[STRIPOFFSETS].data
compression = getdata(CompressionType, ifd, COMPRESSION, COMPRESSION_NONE)

rtype = rawtype(ifd)
Expand All @@ -239,7 +239,7 @@ function Base.read!(target::AbstractArray{T, N}, tf::TiffFile{O, S}, ifd::IFD{O}
@debug "reading $(cmprssn), $(istiled(ifd) ? "tiled" : "striped"), $(isplanar(ifd) ? "planar" : "chunky") image"

# number of input bytes in each strip or tile
encoded_bytes = istiled(ifd) ? ifd[TILEBYTECOUNTS].data : ifd[STRIPBYTECOUNTS].data
encoded_bytes = TILEBYTECOUNTS in ifd ? ifd[TILEBYTECOUNTS].data : ifd[STRIPBYTECOUNTS].data

# number of samples (pixels * channels) in each strip or tile
strip_samples::Vector{Int} = []
Expand Down

0 comments on commit 79d5508

Please sign in to comment.