Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFDs should be preserved verbatim when reading images #160

Open
chrstphrbrns opened this issue Apr 10, 2024 · 3 comments
Open

IFDs should be preserved verbatim when reading images #160

chrstphrbrns opened this issue Apr 10, 2024 · 3 comments

Comments

@chrstphrbrns
Copy link
Contributor

Currently, IFDs are altered when an image is read, but this is surprising and not ideal

@tlnagy
Copy link
Owner

tlnagy commented Apr 10, 2024

What do you mean they are altered?

@chrstphrbrns
Copy link
Contributor Author

The DenseTaggedImage constructor modifies them, or at least rewrites them (which leaves the possibility that they'd be modified)

@tlnagy
Copy link
Owner

tlnagy commented Apr 10, 2024

Are you referring to _constructifds being called from the constructor?

ifd[IMAGEWIDTH] = UInt32(size(data, 2))
ifd[IMAGELENGTH] = UInt32(size(data, 1))
n_samples = samplesperpixel(data)
ifd[BITSPERSAMPLE] = fill(UInt16(bitspersample(data)), n_samples)
ifd[PHOTOMETRIC] = interpretation(data)
ifd[SAMPLESPERPIXEL] = UInt16(n_samples)
if !(T <: Gray{Bool}) # bilevel images don't have the sampleformat tag
ifd[SAMPLEFORMAT] = fill(UInt16(sampleformat(data)), n_samples)
end
extra = extrasamples(data)
if extra !== nothing
ifd[EXTRASAMPLES] = extra
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants