Is there an inverse to the AlphaPremul method?
Based on the thread here, it seems that AlphaComp always produces pre-multiplied results. If I want to save those results to PNG, I have to un-premultiply them. I dont see an inverse to the AlphaPremul method. Is there some other way of un-premultiplying an image, or so I have to write it by hand?
I am afraid we do not have, you probably could consider implemented by self. If you use AlphaPremul that means you already get Cr|g|b= Ar|g|b * αA , (αA=αC) and you would like to get RGB value of A, you could calculate by Cr|g|b*1/αC
Maybe you can consider this an addition for the future. Since you already have optimized code for doing the premul, it should be really easy do 1/alpha at the same time. Of course I can do it myself, but it likely will not be as optimized as the code you have for premul.
Yesterday I checked that ippiMul and ippiAlphaPremul are equivalent and remembered this thread, so ippiDiv should work with the caveat that it won't support the alpha packed with the RGB. You would need separate planes.
ippiDiv has the problem of division by zero (returning an warning error code for u and s integer types and producing NAN_32F, INF_32F or INF_NEG_32F values for floating-point types). So, I do feel that AlphaUnPremul functions are missing. For example, Apple's vImage library has vImageUnpremultiplyData functions for the purpose.
Adriaan van Os