Skip to content

Better support for palette color images #189

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

Merged
merged 6 commits into from
Jun 24, 2025
Merged

Conversation

lanceXwq
Copy link
Contributor

This should close #188.

Please note: my editor auto-formats the code, so the diff may appear larger than the actual changes.

In short, I’ve added two new methods to interpretation, samplesperpixel, and bitspersample, respectively, to handle the corresponding tags for palette color images. I’d appreciate it if you could take a look and let me know if anything needs adjusting!

@codecov-commenter
Copy link

codecov-commenter commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 90.24390% with 4 lines in your changes missing coverage. Please review.

Project coverage is 93.37%. Comparing base (ff965a6) to head (fe14066).

Files with missing lines Patch % Lines
src/types/common.jl 89.47% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #189      +/-   ##
==========================================
+ Coverage   93.33%   93.37%   +0.03%     
==========================================
  Files          15       15              
  Lines        1186     1192       +6     
==========================================
+ Hits         1107     1113       +6     
  Misses         79       79              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tlnagy
Copy link
Owner

tlnagy commented Jun 11, 2025

Awesome @lanceXwq! Thanks for doing this. Do you mind bumping the patch version?

Also, there seem to be some failures on Julia 1.6. My guess is there's an inference difference between 1.6 and 1.10+?

@lanceXwq
Copy link
Contributor Author

I tried reproducing the CI runs on macOS and Ubuntu with Julia v1.6.7. All tests passed locally, so the issue might not be related to the Julia version, but possibly to some differences in package versions.
On my machine:

julia> import Pkg; Pkg.test(;coverage=true, julia_args=["--check-bounds=yes", "--compiled-modules=yes", "--depwarn=yes"])
     Testing TiffImages
      Status `/tmp/jl_NPnUut/Project.toml`
  [4c88cf16] Aqua v0.8.13
  [39de3d68] AxisArrays v0.4.7
  [3da002f7] ColorTypes v0.12.1
  [c3611d14] ColorVectorSpace v0.11.0
  [e30172f5] Documenter v1.12.0
  [53c48c17] FixedPointNumbers v0.8.5
  [6fe1bfb0] OffsetArrays v1.17.0
  [fdea26ae] SIMD v3.7.1
  [5e47fb64] TestImages v1.9.0
  [731e570b] TiffImages v0.11.4 `~/ASU Dropbox/Xu Weiqing/Code/Julia/TiffImages.jl`
  [f43a241f] Downloads `@stdlib/Downloads`
  [10745b16] Statistics `@stdlib/Statistics`
  [8dfed614] Test `@stdlib/Test`

GitHub CI:

Testing TiffImages
      Status `/private/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/jl_Xg3qrS/Project.toml`
  [4c88cf16] Aqua v0.8.13
  [39de3d68] AxisArrays v0.4.7
  [3da002f7] ColorTypes v0.10.0
  [c3611d14] ColorVectorSpace v0.9.2
  [e30172f5] Documenter v1.12.0
  [53c48c17] FixedPointNumbers v0.8.0
  [6fe1bfb0] OffsetArrays v1.0.4
  [fdea26ae] SIMD v3.4.7
  [5e[47](https://github.com/tlnagy/TiffImages.jl/actions/runs/15577707085/job/43919557288?pr=189#step:7:50)fb64] TestImages v1.6.2
  [731e570b] TiffImages v0.11.4 `~/work/TiffImages.jl/TiffImages.jl`
  [f43a241f] Downloads `@stdlib/Downloads`
  [10745b16] Statistics `@stdlib/Statistics`
  [8dfed614] Test `@stdlib/Test`

It looks like several dependencies are quite a bit older on CI, which might explain the differences we’re seeing. Would updating the compat entries in Project.toml make sense to ensure CI picks up more recent versions?

I can bump the patch version once this is resolved.

@tlnagy
Copy link
Owner

tlnagy commented Jun 13, 2025

That's interesting. You also ran Julia using julia --project="." in the TiffImages folder? Your dependencies should be the same as on the CI. For example, TiffImages has an explicit request for SIMD=v3.4.* while you have 3.7.1 installed. That said, our dependencies are out of date and we need to bump them (which I'm doing over in #187).

@lanceXwq
Copy link
Contributor Author

You also ran Julia using julia --project="." in the TiffImages folder?

Yes, I did.

For example, TiffImages has an explicit request for SIMD=v3.4.* while you have 3.7.1 installed.

The current Project.toml specifies SIMD = "3.4.5" which, according to the Pkg.jl compatibility documentation, should allow versions in [3.4.5, 4.0.0). Am I interpreting the doc correctly?

In the meantime, I’m trying to reproduce the CI failure by matching the exact package versions used in the GitHub run. Hopefully, that helps pinpoint the issue.🤞

@lanceXwq
Copy link
Contributor Author

I tracked down the issue, @tlnagy. When IndirectArrays.jl was upgraded to v1.0.0, an additional type parameter was introduced (relevant commit). My earlier PR version relied on this new parameter, which caused compatibility issues when used with IndirectArrays v0.5.1.

@tlnagy
Copy link
Owner

tlnagy commented Jun 24, 2025

Awesome! Thanks for doing this.

@tlnagy tlnagy merged commit b5bf0ef into tlnagy:master Jun 24, 2025
14 checks passed
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

Successfully merging this pull request may close these issues.

BITSPERSAMPLE gets overwritten from 8 to [16, 16, 16]
3 participants