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

12-bit images are saved with errors #181

Closed
olejorik opened this issue Jan 17, 2025 · 4 comments
Closed

12-bit images are saved with errors #181

olejorik opened this issue Jan 17, 2025 · 4 comments

Comments

@olejorik
Copy link

olejorik commented Jan 17, 2025

When running some old code on an updated environment, I noticed that 12-bit images (that is, with elements of Gray{N4f12} type) are saved with errors.
I have checked with the old version of TiffImages.jl; it works as expected. Here is a MWE:

 ]activate --temp
 ]add [email protected]
 ]add ImageCore, FileIO

using TiffImages, ImageCore, FileIO
ttt = ((1:100)' .+ (1:100) )/200
sss = Gray{N4f12}.(TTT)
save("im4f12_old.tif",sss)

The result is this
Image

If you run the same MLE without specifying the version for TiffImages, the result is like this:
Image

I'm on Windows, julia 1.11.2.

@chrstphrbrns
Copy link
Contributor

Neither version is saving the data correctly, although the older version fails less spectacularly than the current one. Writing files with unusual bit depths has probably never been supported

Fortunately, I had done some preparatory work for this scenario a while back, so I've been able to put a PR together without too much effort

@olejorik
Copy link
Author

Neither version is saving the data correctly, although the older version fails less spectacularly than the current one. Writing files with unusual bit depths has probably never been supported

Maybe there is some error in what is saved by the old version, but I'm not aware of it. The data are in full correspondence with what I've got from a 12-bit camera.

@chrstphrbrns
Copy link
Contributor

The actual bottom-right pixel in your example is Gray{N4f12}(1.0)

If you load the file with v0.6.3 you'll see it represented as Gray{N0f16}(0.06249)

@tlnagy
Copy link
Owner

tlnagy commented Jan 23, 2025

Should be fixed on latest master thanks to @chrstphrbrns!

@tlnagy tlnagy closed this as completed Jan 23, 2025
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

3 participants