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; }
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.