Declined
Last Updated: 13 Mar 2023 14:24 by ADMIN
Legrand
Created on: 13 Mar 2023 10:26
Category: UI for .NET MAUI
Type: Feature Request
0
bitmap

What is the best way to load a byte[] (which is a jpeg file) in the ImageEditor.

Ideally I want to transform the byte[] to a Bitmap (easy), for storage purpose

            using Stream stream = new MemoryStream(e.Buffer);
            using Bitmap image = new Bitmap(stream);

And then display the bitmap, but I don't know how totransform it to an ImageSource.

Regards.

4 comments
ADMIN
Didi
Posted on: 13 Mar 2023 14:24

Hi Legrand, 

I am glad to hear you have found a solution for this.

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Legrand
Posted on: 13 Mar 2023 11:04
Finally, I found a solution using Ironsoftware.drawing. Very nice library!
Legrand
Posted on: 13 Mar 2023 10:41

Hello Didi,

 

I need to do some processing on my photo, that's why I need to transform my byte[] as a Bitmap

So I need a way to transform my bitmap to an ImageSource.

 

Bruno.

ADMIN
Didi
Posted on: 13 Mar 2023 10:35

Hi Legrand,

The Telerik RadImageEditor Source property is of type Microsoft.Maui.Controls.ImageSource. The supported sources for loading images in the RadImageEditor are: From Stream, From Resource, From Uri and From File. The documentation and examples show all four approaches. If you want to use byte array, then you can convert the byte array to a stream and pass the stream to the RadImageEditor Source. 

Or use the byte array to image source converter provided from the CommunityToolkit: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/converters/byte-array-to-image-source-converter
It is up to you which approach to use. For such how-to scenarios, I would like to ask you to use the support ticketing system or Telerik .NET MAUI forum. The feedback portal is for submitting feature requests/bug reports for the product. 

Thank you for the understanding. 

Regards,
Didi
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.