Skip to content

Commit

Permalink
fix reported BPS for irregular values (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstphrbrns authored Mar 21, 2024
1 parent 992f362 commit 58afaec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TiffImages"
uuid = "731e570b-9d59-4bfa-96dc-6df516fadf69"
authors = ["Tamas Nagy <[email protected]>"]
version = "0.9.0"
version = "0.9.1"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand Down
3 changes: 2 additions & 1 deletion src/types/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ samplesperpixel(img::AbstractArray) = samplesperpixel(eltype(img))
samplesperpixel(::Type{<: Colorant{T, N}}) where {T, N} = N

bitspersample(img::AbstractArray) = bitspersample(eltype(img))
bitspersample(::Type{<: Colorant{T, N}}) where {T, N} = sizeof(T)*8
bitspersample(::Type{<: Colorant{T, N}}) where {T, N} = sizeof(T) * 8
bitspersample(::Type{<: Colorant{<: FixedPoint{T, S}, N}}) where {T, S, N} = S

sampleformat(img::AbstractArray) = sampleformat(eltype(img))
sampleformat(::Type{<: Colorant{T, N}}) where {T <: AbstractFloat, N} = SAMPLEFORMAT_IEEEFP
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ end
m = sum(ref.data .- other.data) ./ length(ref)
@test m.r < 0.001 && m.g < 0.001 && m.b < 0.001

@test other.ifds[1][TiffImages.BITSPERSAMPLE].data == UInt16[12,12,12]

other = TiffImages.load(get_example("shapes_lzw_14bps.tif"))
m = sum(ref.data .- other.data) ./ length(ref)
@test m.r < 0.001 && m.g < 0.001 && m.b < 0.001
Expand Down

0 comments on commit 58afaec

Please sign in to comment.