bpifre / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

Filters.Grayscale does not maintain transparency. #376

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Filters.Grayscale does not maintain transparency.
If one filters.grayscales a png having a transparency .... the transparency is 
not maintained ... it goes to black

What is the expected output? What do you see instead?

1)Clear
2)Black where the transparency was

Best regards

Adam

Original issue reported on code.google.com by adamjame...@gmail.com on 20 Jan 2014 at 12:13

GoogleCodeExporter commented 8 years ago
Most often a grayscale image is just an 8 bpp image with values from 0 to 255. 
.NET Framework however does not have proper support of 8 bpp grayscale images, 
but provides 8 bpp indexed images (which is what is used in AForge.NET 
framework for graysclae images). But this does not change the point. 8 bpp 
indexed image will not help either.

You can try another approach however:

SaturationCorrection filter = new SaturationCorrection( -1 );
filter.ApplyInPlace( image );

This will keep your image as 32 bpp image.

Original comment by andrew.k...@gmail.com on 20 Jan 2014 at 12:40