Uri uri = new Uri(path); var bitmap = new BitmapImage(uri); BitmapSource image = bitmap; int bytesPerPixel = (int)Math.Truncate((image.Format.BitsPerPixel + 7.0) / 8.0); int stride = image .PixelWidth * bytesPerPixel; int len = image.PixelHeight * stride; byte[] pixels = new byte[len]; image.CopyPixels(pixels, stride, 0);
JpegBitmapDecoder jpegDecoder = new JpegBitmapDecoder(uri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad); BitmapFrame BmpFrame = jpegDecoder.Frames[0];
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)