
Botte 3D stilizzata (Modo, Zbrush)

public static System.Windows.Controls.Image ByteArrayToImage(byte[] bytesImg) { System.Windows.Media.Imaging.BitmapImage bitmapImage = new System.Windows.Media.Imaging.BitmapImage(); bitmapImage.BeginInit(); bitmapImage.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; bitmapImage.StreamSource = new MemoryStream(bytesImg); bitmapImage.EndInit(); System.Windows.Controls.Image img = new System.Windows.Controls.Image(); img.Source = bitmapImage; return img; }
public static byte[] BitmapImageToByteArray(System.Windows.Controls.Image img) { byte[] ImgTemp; System.Windows.Media.Imaging.BitmapImage bitmapImage = new System.Windows.Media.Imaging.BitmapImage(); bitmapImage = ((System.Windows.Media.Imaging.BitmapImage)img.Source); System.Windows.Media.Imaging.JpegBitmapEncoder encoder = new System.Windows.Media.Imaging.JpegBitmapEncoder(); encoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(bitmapImage)); using (MemoryStream ms = new MemoryStream()) { encoder.Save(ms); ImgTemp = ms.ToArray(); } return ImgTemp; }