Hello,
I would like to ask you how to load an image from byte array into ImageEdit.
Thank you
Ales Kodys
Hello,
I would like to ask you how to load an image from byte array into ImageEdit.
Thank you
Ales Kodys
Hello,
To load the image to ImageEdit from the bytes array, convert your bytes array to a BitmapImage and set the result as the ImageEdit.EditValue property value:
C#static BitmapImage BytesToImage(byte[] imageData) {
if (imageData == null || imageData.Length == 0) return null;
var image = new BitmapImage();
using (var mem = new MemoryStream(imageData)) {
mem.Position = 0;
image.BeginInit();
image.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
image.CacheOption = BitmapCacheOption.OnLoad;
image.UriSource = null;
image.StreamSource = mem;
image.EndInit();
}
image.Freeze();
return image;
}
private void OnSetImageButtonClick(object sender, RoutedEventArgs e) {
imageEdit.EditValue = BytesToImage(imageBytes);
}
Hello,
You are welcome. If you need further assistance, please do not hesitate to contact us.
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.