4 ms·
As someone who have implemented both EXR and PNG I can explain! Alpha can be used in multiple ways, most commonly as a blend: result = background * (1.0 - alp
by quelsolaar 3y ago
As someone who have implemented both EXR and PNG I can explain!
Alpha can be used in multiple ways, most commonly as a blend:
result = background * (1.0 - alpha) + forground * alpha;
If the alpha and forground is stored in the same image, you can notice that we can pre compute forground * alpha. This is known as pre-multiplication, and is a very common techniqe. An added benefit of this is that we get more dynamic range, and can add to the composit, without removing the background.
This is possible in both PNG and EXR. HOWEVER, if you dont intend to pre-multiply, then the forground is not used if alpha is zero. The people who implemented LibPNG, the most common implementation of PNG, figured that they could make an optimization by throwing away the forground and just store black if alpha is zero. This improves file sizes since run length encoding is used.
This means that while, PNG the format, can store forground data with zero alpha, any application using LibPNG or other implementation with the same optimization may throw away the data. Photohop is a prime example of this. This makes PNG very unreliable when working with alpha.