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

Show warning if TIFF #54

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Show warning if TIFF #54

wants to merge 5 commits into from

Conversation

aneust
Copy link

@aneust aneust commented Feb 26, 2025

This update introduces a warning message when a user adds a TIFF file to the upload list and closes #22

  • Displays a notification indicating that only large TIFF files (10,000+ px) are supported.

@aneust aneust requested a review from lehecht February 26, 2025 13:43
@lehecht
Copy link
Contributor

lehecht commented Feb 28, 2025

I noticed that the message is still displayed even after removing all .tiff files. Is that the way it should be? (Just asking)

@aneust
Copy link
Author

aneust commented Mar 4, 2025

I wanted that it is not displayed anymore.

@aneust aneust requested a review from lehecht March 4, 2025 18:40
@lehecht
Copy link
Contributor

lehecht commented Mar 5, 2025

You can request a review from Martin when you're done.

@aneust aneust requested a review from mzur March 5, 2025 10:23
Copy link
Member

@mzur mzur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good so far! Did you look into whether the actual TIFF size could be checked via JS, too? You probably need a JS package to read TIFFs for this. Then we could show an actual error that prevents users from uploading too small files.

If checking the TIFF locally is too complicated then we can keep the current implementation.

@@ -190,6 +190,10 @@ class="btn btn-success"
Spaces in the file and directory names were replaced by underscores.
</p>

<p v-cloak v-if="hasTIFFfile" class="text-warning">
Only large TIFF files (10,000+ px) are supported. Smaller files may not work.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must use the config value: {{config('images.threshold')}}.

@@ -190,6 +190,10 @@ class="btn btn-success"
Spaces in the file and directory names were replaced by underscores.
</p>

<p v-cloak v-if="hasTIFFfile" class="text-warning">
Only large TIFF files (10,000+ px) are supported. Smaller files may not work.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also:

Suggested change
Only large TIFF files (10,000+ px) are supported. Smaller files may not work.
Only large TIFF files (10,000+ px) are supported. Smaller files cannot be displayed.

@aneust
Copy link
Author

aneust commented Mar 12, 2025

I looked into some options.

One is the UTIF.js library, which can extract the width and height of a TIFF file. The tiff file must first be read as an ArrayBuffer, which is then decoded using UTIF.decode(). This provides metadata, including image dimensions. However, UTIF.js does not support compressed TIFFs (such as JPEG or ZIP-compressed files, not scure if this is needed).

Another option is TIFF.js, which works similarly but is slower because of fully decoding TIFF image.

@mzur
Copy link
Member

mzur commented Mar 12, 2025

So TIFF.js also works with compressed images? Is it as fast as UTIF.js with non-compressed images?

Can you please provide a minimal example code that loads a TIFF and extracts the dimensions for both libraries? I'd like to test them on a 40 GB TIFF we have in BIIGLE.

The utif package seems to be dubious as it is not maintained by the developer. We could use the utif2 package which also claims to support JPEG compressed images. Or we tell NPM to install the package from source.

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.

Show warning with TIFFs
3 participants