unpremultiply
Unpremultiply refers to reversing premultiplied alpha in digital images and color pipelines. In a premultiplied representation, the red, green, and blue channels are stored already multiplied by the alpha channel: R' = R × A, G' = G × A, B' = B × A, where A is the alpha value. Unpremultiply computes the original color values by dividing the stored channels by alpha: R = R'/A, G = G'/A, B = B'/A.
If alpha is zero, the original color is mathematically undefined since division by zero would occur. In
Applications of unpremultiply include image compositing, color correction, texture sampling, and converting between premultiplied and straight
Common considerations include handling division by zero safely, managing numerical precision and rounding artifacts, and performing