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

Improve parsing TIFF files #482

Merged
merged 1 commit into from Aug 23, 2021
Merged

Improve parsing TIFF files #482

merged 1 commit into from Aug 23, 2021

Conversation

Borewit
Copy link
Collaborator

@Borewit Borewit commented Aug 13, 2021

Changes:

  • Smarter TIFF detection smarter, by actually reading the TIFF tags and their contents.
  • Improve Big-Endian encoded TIFF detection.
  • Replaced some TIFF fixtures with larger samples
  • Basic Big TIFF file detection (same extension), no support for specialized type yet

The existing samples are truncated, so these are kind of stuck with old school magic byte pattern matching.
Therefor I replaced them with original files.

The updated Sony file type .arw has been a bit of guess. It basically looks for a tag, which looks like a Sony private tag. Other .arw may or may not have this tags.

Warning: fixtures are very large, 25 MB each!!!
Truncated samples to 100.000 bytes each. This is enough to read it's tags.

Fixes #480

Source sample file .arw: https://www.dpreview.com/sample-galleries/9547785333/

@Borewit Borewit self-assigned this Aug 13, 2021
@Borewit Borewit marked this pull request as draft August 13, 2021 09:33
@Borewit Borewit force-pushed the issue-480-dng-detection branch 2 times, most recently from 8861872 to a7230f6 Compare August 13, 2021 11:25
@Borewit Borewit marked this pull request as ready for review August 13, 2021 13:40
@Borewit Borewit marked this pull request as draft August 13, 2021 18:30
Detect DNG files in a reliable matter.
Improve big-endian encoded TIFF detection.

Fixes: #480
@Borewit Borewit marked this pull request as ready for review August 13, 2021 18:38
@sindresorhus sindresorhus merged commit 82c9ccb into main Aug 23, 2021
@sindresorhus sindresorhus deleted the issue-480-dng-detection branch August 23, 2021 00:16
@sindresorhus
Copy link
Owner

Nice work! 👍

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.

DNG is falsely detected as TIFF
2 participants