1
Vote

WPF WriteableBitmapExtensions.Resize incorrect alpha value in the final picture

description

For source bitmap with alpha channel WriteableBitmapExtensions.Resize(BitmapContext srcContext, int widthSource, int heightSource, int width, int height, Interpolation interpolation) returns incorrect alpha values in the result bitmap.

This method uses WriteableBitmapExtensions.Resize(BitmapContext srcContext, int widthSource, int heightSource, int width, int height, Interpolation interpolation) to resize bitmap.

WriteableBitmapExtensions.Resize(BitmapContext srcContext, int widthSource, int heightSource, int width, int height, Interpolation interpolation) returns bitmap in bgra32 pixel-format.

Then WriteableBitmapExtensions.Resize(this WriteableBitmap bmp, int width, int height, Interpolation interpolation) method uses BitmapFactory.New(width, height) to create result bitmap.
var result = BitmapFactory.New(width, height);
BitmapFactory.New(width, height) creates pbgra32 bitmap.
Incorrect alpha value in in the final picture as result.

comments