user963935
user963935

Reputation: 652

Int array to WriteableBitmap in windows phone

How to convert array of pixels int[] to WriteableBitmap in Windows Phone 8? Later on I'd like to save this image to MediaLibrary.

Upvotes: 1

Views: 896

Answers (2)

Luqman
Luqman

Reputation: 1239

You may use copyTo member function of int[] for copying int[] to WriteableBitmap.

int[] ARGBPx = new int[(int)captureDevice.PreviewResolution.Width * (int)captureDevice.PreviewResolution.Height];            
WriteableBitmap writeableBitmap_preview;        

ARGBPx.CopyTo(writeableBitmap_preview.Pixels, 0);         
writeableBitmap_preview.Invalidate();

Upvotes: 0

Cellcon
Cellcon

Reputation: 1295

The only way I know on Windows Phone is using the WriteableBitmapEx library. In addition to WriteableBitmap it implements an "SetPixel method with various overloads":

http://writeablebitmapex.codeplex.com/

The Library can simply be installed from within Visual Studio 2012:

PROJECT => Manage NuGet Packages => Online => Search for "WriteableBitmapEx"

Upvotes: 1

Related Questions