WPF, am I a bitmap or a PNG -
My goal is to work with bitmaps but I have to store them in PNG bit arrays:
bitmap image imaggrus = (bitmap image) this.FindResource ("imageGrass");
I'm curious at this point if it's bitmap or PNG. If I copy the pixels to the user, then I know that its uncompressed bitmap where I've been unsuccessful:
PngBitmapEncoder encoder = new PngBitmapEncoder (); Encoder.frames.Add (bitmapFrame.Create (imageGrass)); Byte [] ImageData; (Using memorystream imagestream = new memorystream ()) {encoder. Save (Image Stream); ImageData = New Byte [Imagestream. Lamps]; ImageStream.Read (imageData, 0, (int) imageStream.Length); ImageStream.Flush (); ImageStream.Close (); }
Now it can be related to memory stream because I can encode and save a file.
Main question: How can I store a PNG byte array?
This article should be screwed for you
Good luck.
Comments
Post a Comment