Skip to content

Instantly share code, notes, and snippets.

@nuitsjp
Created October 17, 2016 01:52
Embed
What would you like to do?
Create BitmapSource by specifying a format from the byte sequence
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