Jump to content

TIFF: the "sampleformat" tag is not correctly updated (or removed) when needed


Recommended Posts

A 24 bits TIFF file (3 samples per pixel: R,G,B) which correctly contains 3 values for the SampleFormat TIFF tag (one for each of the 3 samples), after being edited and saved by paint.net 4.3.12 as a 32 bits TIFF file (4 samples per pixel: R,G,B,A) still incorrectly contains the same 3 values of the sampleformat TIFF tag instead of the correct 4 values (one for each of the 4 sample). So it seems paint.net fails to update the sampleformat TIFF tag to 4 values (i.e. adding the 4th value for the 4th sample per pixel).
 

This lead to the impossibility to open the TIFF file with some image processing software like GIMP, which throws the error: Not a TIFF image or image is corrupt / Incorrect count for SampleFormat; or GIS software like QGIS which thrown the error: TIFFReadDirectory:Incorrect count for "SampleFormat".

 

To replicate the issue:

- open the "sample.tiff" 24 bit file (contained in the attached "sample.zip" file) with paint.net

- save the image as a 32 bit tiff file

 

While the original "sample.tiff" 24 bit file can be opened by e.g. GIMP or QGIS without issue, the new 32 bit file saved by paint.net cannot be opened by e.g. GIMP or QGIS.

sample.zip

Edited by Andrea Giudiceandrea
Link to comment
Share on other sites

@BoltBait, TIFF is a built-in file format, not one of @null54's bundled plugins :)

 

@Andrea Giudiceandrea, I'll take a look at this for the 5.0 release. Looks like SampleFormat is just a regular EXIF tag, so it should be easy enough to set the right value.

 

If there's a 4.3.13 release, which would arrive much sooner than 5.0, I may be able to get it in there as well, but I currently don't have plans for that. (doesn't mean it won't happen though)

  • Thanks 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

@Andrea Giudiceandrea

 

Paint.NET uses the TIFF support that is built-in to the OS, so this would be a bug in Windows Imaging Component.

 

6 hours ago, Andrea Giudiceandrea said:

So it seems paint.net fails to update the sampleformat TIFF tag to 4 values (i.e. adding the 4th value for the 4th sample per pixel).

 

That appears to be the issue.

The libtiff tiffinfo utility gives the same error as GIMP, and the tiffdump utility shows the incorrect SampleFormat tag.

 

9 minutes ago, Rick Brewster said:

I'll take a look at this for the 5.0 release. Looks like SampleFormat is just a regular EXIF tag, so it should be easy enough to set the right value.

 

It is a TIFF tag, EXIF is based on TIFF.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

4 hours ago, Rick Brewster said:

@BoltBait, TIFF is a built-in file format, not one of @null54's bundled plugins :)

 

Sorry, didn't mean to step on anyone's toes... he's just really good at root-causing filetype issues and thought he might help you by researching this one.

  • Like 1

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...