Alpha Channel Image Printing in .net artifacting

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
Allright this one is confusing the hell out of me.

I've got a routine which creates a drawing. In the drawing, there is an alpha channeled png being drawn - it's loaded into a bitmap object, then printed using graphics.printimage.

On the screen, it works great. In the print preview dialog, it also seems to work great. However, when actually gets print out, it fails horrifically. Instead of a nice alpha blend, I get a very harsh border. It's rather peculiar - like it is printing to the alpha channel, but unless the alpha channel is zero, it's using the background "color" to blend instead of the color that's already there. And where the alpha value is zero, it doesn't do anything, and instead prints through normally.

CompositingMode is set to sourceover, and honestly, I'm out of ideas here. Any guesses or hints as to why something like this would happen, and only in actual print output?
 

bsobel

Moderator Emeritus<br>Elite Member
Dec 9, 2001
13,346
0
0
I haven't researched this, but I'm gonna guess the print driver is doing the alpha merge and isn't handling it well. I'd try a few other printers to verify (different brands or at least different drivers). If true you'll probably have to create a new bitmap and copy the 'output' bitmap into it (so its a true bitmap, no alpha layer) and print that.
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
Meh. I was hoping to avoid doing that - the routine gets passed a graphics object so that it can be used for screen or printer printing. Unfortunately, there's no way to get the value of what's already in a particular position from the graphics object, and what's underneath can be a sub-portion of another image, so it's not that simple.


It does seem to be the problem though. Wasn't my first suspect since the pdf printer and the local printer were behaving identically, but a third printer behaves properly. Thanks for the information.