Re:Premultiplied Alpha vs. Not-Premultiplied Alpha Blending ...
by im3w1l on Saturday October 22, 2022 @08:03PM
(#33303326)
Gamma does however have an effect on blurring. And I suspect that because of gamma correction, applying a blur filter to a premultiplied image is (very subtly) incorrect.
[ Parent
| on HN ]
Re:Premultiplied Alpha vs. Not-Premultiplied Alpha Blending ...
by ljkbkhvj on Saturday October 22, 2022 @08:14PM
(#33303380)
Yes, I think the possibilities, in practice, for bad interactions between gamma-related and alpha-related operations are real.
"PS3 does sRGB conversion before alpha-blending, so the blending is done in gamma space, which is not quite right."
Re:Premultiplied Alpha vs. Not-Premultiplied Alpha Blending ...
by Sesse__ on Sunday October 23, 2022 @07:19AM
(#33306105)
Applying a blur filter to a premultiplied image is (very subtly) _correct_, at least if the goal is to emulate what happens if you used a physical lens to blur the same image. Not only does postmultiplied alpha mess up the correct pixel values (as the original post shows), but even without alpha, you get a “halo” that is weird and unphysical.
Re:Premultiplied Alpha vs. Not-Premultiplied Alpha Blending ...
by im3w1l on Sunday October 23, 2022 @09:39AM
(#33306911)
I think corysama had the right of it, you need to do all the operations in linear colors, i.e.
original image -> convert to linear color space -> multiply alpha -> blur -> composite -> possibly convert back to sRGB if needed
The wrong way I meant was
original image -> multiply alpha -> gamma-correct-blur -> composite
where gamma-correct-blur = convert to linear color space -> blur filter -> convert to sRGB