Friday, November 17, 2006 9:45 AM
by
loufranco
Images in WPF vs. DotImage
UPDATE: Atalasoft DotImage 6.0 uses some of the information discussed here to deliver the industry's first WPF Imaging SDK.
As the .NET 3.0 release date gets closer, more people are asking how to use DotImage commands on the new WPF and WIC image objects.
I wrote a knowledge base article to provide code for translating between BitmapSource and AtalaImage:
http://www.atalasoft.com/kb/article.aspx?id=10156
There are a few differences between how pixel data and other image information is stored in a BitmapSource and AtalaImage:
- Different classes. Obviously two independently developed frameworks use their own classes. It's not just BitmapSource and AtalaImage. We use different Palette, PixelFormat, Resolution, and Color classes as well.
- Channel order. The channels in CMYK images in WPF are the reverse of what we use in DotImage.
- Conventions for Black and White images. WPF has two pixel formats that could be used for 1-bit images: PixelFormats.Indexed1 and PixelFormats.BlackWhite. In DotImage we use just Pixel1bppIndexed, so when WPF images with the PixelFormat set to BlackWhite are loaded, we need to create a palette which matches the WPF convention (0 is Black and 1 is White).
All of the code for that is attached to the KB article.