Kevin Brant
Kevin Brant

Reputation: 141

Image editing with universal windows app in C#

I am trying to build a Universal Windows App in C# that involves opening an image, re-sizing it, editing some of the pixels' RGB values and saving it again. After looking around the net for a while I found that most people seemed to be using the namespace "System.Drawing.Imaging" to do similar things, however when I tried to include "System.Drawing.Imaging", Visual Studio told me that the namespace didn't exist.

I believed this may just be that some namespaces that are available for .NET programs are not available for Universal Windows Apps, so I tried looking around some more and found a similar namespace that could be used, "Windows.UI.Xaml.Media.Imaging", however this one is much more limited than "System.Drawing.Imaging" and cannot read or edit pixels as far as I could tell.

Is there another namespace I could use, or a way to get "System.Drawing.Imaging" to in a Universal Windows App? If there isn't anyway of doing something like this with a Universal Windows App in C#, is there a way to do it in another language? Any tips or pointers would help.

Upvotes: 0

Views: 1521

Answers (1)

Rob Caplan - MSFT
Rob Caplan - MSFT

Reputation: 21889

For straight pixel manipulations you can use Windows.UI.Xaml.Media.ImagingWriteableBitmap and stream out of and back into its PixelBuffer property. There is a third party library WriteableBitmapEx which provides extension methods to perform higher level manipulations on the buffer.

Another alternate is the Win2D library which exposes the low level Direct2D and DirectWrite libraries to UWP apps.

Upvotes: 2

Related Questions