Page MenuHome

TIFF 8bit always saved and loaded as unassociated alpha
Open, Confirmed, LowPublic

Description

Operating system: Linux amd64 Debian Buster
Graphics card: NA

Broken: All
Worked: Possibly way back.

Blender can handle own TIFFs

TIFF handling in Blender has been forever been broken for a number of reasons.

By default TIFFs encode associated alpha. Sadly, Blender had a hack that tried to "preserve" background pixels, coupled with saving with extrasamples set to unassociated alpha. The result is that Blender can't properly load it's own files.

Details

Differential Revisions
D4175: TIFF encoding / decoding fix
Type
Bug

Event Timeline

Brecht Van Lommel (brecht) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.Jan 6 2019, 2:48 PM

Please provide exact steps to redo the problem. There are like a dozen possible combinations of settings here, and if we're not precise it's easy to fix one case but break another.

  1. Save an image with alpha from Blender, or attempt to find a image with unassociated alpha on the net. The latter will be virtually impossible as TIFFs by canonical default are associated.
  2. Load the file in Blender.

Result is broken.

In the following Blend file, the first is a legitimate associated alpha TIFF. Blender, due to goofy alpha handling at 8 bit, decides to unassociate the alpha as per convention for all 8 bit formats. When saving a direct copy of the image as a TIFF, the result is broken. Sample Blend file F6202617.

As far as I can tell the issue can be summarized as: if you use 8 bit TIF images as digital intermediates, then saving and loading these will go through a lossy associated -> unassociated -> associated conversion, because Blender always saves 8 bit files unassociated. When using 16 bit TIF images there is no such issue, as they are saved with associated alpha.

This seems like more of a theoretical issue since 8 bit is not appropriate for digital intermediates, but it could be fixed.

I believe it is more than a round trip quantisation issue.

From what I can tell, saving directly from an input node mangles the alpha in the resultant image. The encoded values are unrecoverable. I think the issue is the hack, but I may be incorrect.

I believe you are quite correct in that the diff ends up doing the opposite. The difference is that the encoded file values are recoverable.

I’d add that if the baseline in all of Blender were associated, the many, many, many non trivial alpha errors, including the flip flop issue you cited, would be solved. You’d never be going unassociated from associated at 8 bit, as it is nonsensical.

Philipp Oeser (lichtwerk) raised the priority of this task from Needs Information from User to Normal.Jan 15 2019, 1:16 PM
Brecht Van Lommel (brecht) renamed this task from TIFF HANDLING: Completely broken with files generated from within Blender to TIFF 8bit always saved and loaded as unassociated alpha.Jan 28 2019, 1:32 PM
Brecht Van Lommel (brecht) triaged this task as Confirmed, Low priority.