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

[imageio] Support TIFF with any number of samples per pixel #18192

Merged
merged 2 commits into from
Jan 12, 2025

Conversation

victoryforce
Copy link
Collaborator

Fixes #18187.

This PR fixes a regression introduced in 5.0.0 after the imageio code refactoring.

Actually, the TIFF loader itself did not support reading 2-channel (luminance + alpha) images before either. But darktable is usually built with support for the GraphicsMagick (or ImageMagick) fallback loader. So such files used to be loaded using a fallback loader.

This broke when additional loader failure codes were introduced, and the code returned in this particular case (DT_IMAGEIO_UNSUPPORTED_FEATURE) was not added to the fallback loader call condition.

The TIFF loader code was actually ready to correctly read files with any number of channels (samples per pixel). So this fix simply removes the restriction on the number of channels and adds the correct interpretation of 2-channel files as monochrome.

@victoryforce victoryforce added this to the 5.0.1 milestone Jan 11, 2025
@TurboGit TurboGit added bugfix pull request fixing a bug priority: medium core features are degraded in a way that is still mostly usable, software stutters release notes: pending labels Jan 12, 2025
@TurboGit TurboGit merged commit 57d7f14 into darktable-org:master Jan 12, 2025
6 checks passed
@TurboGit
Copy link
Member

Merged in master and 5.0.x branch.

@victoryforce victoryforce deleted the fix-18187 branch January 12, 2025 07:21
@victoryforce
Copy link
Collaborator Author

Files to verify the correctness of this fix can be downloaded from https://github.com/tlnagy/exampletiffs:

  • house.tif - 2 channel (luminance + alpha) image
  • shapes_hyper.tif - 7 channels (RGB + 4 extra channels that we have to ignore)

These files must be read correctly, the "image information" module must specify TIFF loader (not fallback one, like GraphicsMagick).

@victoryforce
Copy link
Collaborator Author

Suggested release notes text:

Fixed a regression introduced in 5.0.0 where we lost the ability to read 2-channel TIFF files and files with more than 4 channels. This fix allows them to be read by the TIFF loader, whereas previously the TIFF loader rejected such files and they were loaded by a fallback loader (GraphicsMagick or ImageMagick).

@TurboGit
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix pull request fixing a bug priority: medium core features are degraded in a way that is still mostly usable, software stutters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Darktable 5.0.0 - Some .tiff files return "Image x.tiff could not be loaded unsupported feature in file"
2 participants