Skip to content

BITSPERSAMPLE gets overwritten from 8 to [16, 16, 16] #188

@lanceXwq

Description

@lanceXwq

This may be partially related to #72, but seems to cover only a specific aspect of it.

The attached file is expected to be an 8-bit grayscale image stack. However, when loaded using TiffImages.jl, it is interpreted as a 16-bit RGB image.

Upon investigating, I suspect the issue may stem from this line:

data = fixcolors(loaded, first(ifds))
Specifically, fixcolor appears to convert eltype(data) from TiffImages.Palette{FixedPointNumbers.N0f8} to ColorTypes.RGB{FixedPointNumbers.N0f16}.

As a result, this later line:

ifd[BITSPERSAMPLE] = collect(UInt16.(bitspersample(data)))
overwrites the IFD's BITSPERSAMPLE tag from Tag(BITSPERSAMPLE, 8) to Tag(BITSPERSAMPLE, UInt16[16, 16, 16]).

I observed similar behavior with the TIF file referenced in #72.

Could you clarify whether this is the intended behavior? If not, I’d be happy to help fix it. 😃

ROI_2_camera_A_raw.tiff.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions