Created
October 17, 2016 01:52
-
-
Save nuitsjp/8f66496f26b075a9a29b284e93f6e3f2 to your computer and use it in GitHub Desktop.
Create BitmapSource by specifying a format from the byte sequence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static BitmapSource CreateFormJpeg(byte[] bytes) | |
{ | |
using (var stream = new MemoryStream(bytes)) | |
{ | |
var decoder = new JpegBitmapDecoder(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad); | |
return decoder.Frames[0]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment