private byte[] GetBitmapBytes(Bitmap bitmap) { if (bitmap == null) { return null; } using (MemoryStream stream = new MemoryStream()) { bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png); stream.Close(); return stream.ToArray(); } }
private BitmapImage ConvertBytesToImage(byte[] imageBytes) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); MemoryStream memoryStream = new MemoryStream(imageBytes); bitmapImage.StreamSource = memoryStream; bitmapImage.EndInit(); return bitmapImage; }
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.