On Tue, 11 Dec 2012, Sebastien Leon wrote: > Hi Bob, > > Thank you for your reply ! > I agree with you regarding the fact that PNG and others are not using > premultiplied alpha and I think it is a very good thing. Using this > "runtime" format to store data is a bad idea as you loose color accuracy > (if not using floating color channels). > However, when the need is a fast graphic composition for screen > rendering, premultiplied alpha saves a lot of time/cpu ! > It makes composition runs ~ twice faster, whatever your CPU or GPU is.
Yes, the composition is faster. This is useful if you need to do it more than once. You pay for the premultiplication just once, and then benefit for subsequent operations. > Regarding "a particular meaning for Alpha", I disagree, for 2 reasons : > > A premultiplied color would be useless for an inverted Alpha : > for inverted alpha, (where 0 is opaque), all RGB value would be 0 > because premultiplied format is RGB' = a * RGB. > So premultiplied alpha exists only for the convention 0 (transparent) to > 1 (opaque). Obviously, the true "alpha" requires that the stored value be inverted before it is used for any math. I was only making the point that lcms should not assume a particular meaning (e.g. zero) for an alpha channel. > A second reason is that many hardware and software composition engine > are expecting this "de facto" normalized premultiplied alpha. > OpenGL, Apple iOs API, Qt QPaintEngine and others are using this format. > In my software, I use such images to compose hundreds of layers before a > final blit to screen. Getting some help from hardware is not a bad thing > to get comfortable FPS. Obviously, my goal is to avoid to do several > format switches for each graphic pipeline stage. > I guess that you don't have this problem with GraphicsMagick (that I > like BTW and uses in my scripts) as don't have to rely on external > tools/libs/hardware. Due to the nature of how GraphicsMagick is usually used (as a utility), the time to load and store images is usually more significant than any composition steps. The typical image file does not include an alpha channel so optimizing for the typical file makes sense. > As PreMultiplied Alpha can be seen as a standard, I think it deserves > some attention ;-) even if supporting it, is not useful for anyone... I agree that it is quite useful if the composition needs to be repeated many times. I don't like that the inventors of TIFF decided to make it the normal case and that "unassociated alpha" has no meaning defined by the standard. Regardless, premultiplied color does not seem to make a lot of sense with a color management system since color perception varies with intensity and the colorspace may not be linear across the color channels. I am not sure how it can work and I am not sure how something like Adobe Photoshop deals with it (I imagine it uses a different colorspace). Bob -- Bob Friesenhahn bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user