How to convert from PhotoResult or BitmapImage to Bitmap?

621 Views Asked by At

How to convert from PhotoResult to Bitmap in Nokia Imaging SDK? I wish to break an image into smaller images. The Bitmap class in Nokia.Graphics.Imaging has a constructor which takes another bitmap and a rectangle. I wish to use it. I cannot find any good examples on this. Please assist.

3

There are 3 best solutions below

1
On BEST ANSWER

Ah - you can first create an EditingSession with

var session = await EditingSessionFactory.CreateEditingSessionAsync(photoResult.ChosenPhoto);

(documentation here) and then render that to a Bitmap with RenderToBitmapAsync() (which has an overload that takes a Rect)

Hope that helps!

old answer:

I'm not sure what a PhotoResult is, but here's the documentation for the constructor you mentioned. What question do you have about it?

0
On

NokiaImagingSDK 1.2

Bitmap bmp = null;
await streamImageSource.GetBitmapAsync(bmp, OutputOption.PreserveAspectRatio);
0
On

In the new version 1.0 of the Nokia Imaging SDK, you can use StreamImageSource to read the ChosenPhoto stream.