#7 – Giza, Babylon, Olympia, Ephesus, Halicarnassus, Rhodes, and Alexandria – the FlattenAlphaCommand
Okay, so the title of this blog post is really just a cheap attempt at misdirection. After all, what more can be said about the FlattenAlphaCommand than:
The FlattenAlphaCommand blends the transparent areas of an image with a solid color to remove the alpha information.
In other words, if you have an image with a transparent background, you can give it a color background. There’s only one property to manage – Color – which you can specify in the constructor. Make sure that the image loaded actually has an alpha channel (or the command will throw a BadPixelFormat exception). The resulting image’s pixel format will be 24 bits per pixel BGR.
The before and after shots of this are going to be wholly unremarkable. Also, I’m limited by the blog utility I use from loading the original, transparent png image, so I’ll show screen shots of the DotImage Demo instead.
Before:
After, with Color set to OldLace:
The next command is one that can produce some nice, funky effects, or correct a nice, boring document: the InvertCommand.
And, as always, remember the Webinars, Twitter (Atalasoft and me), become a Facebook friend, and the Alamo.