简体   繁体   中英

Pixelate an image with c# + xaml

I intend to Pixelate an image in an application c# + xaml for Windows 8 (windows store app) What is the best way to do this?

I found this code in C# ( http://notes.ericwillis.com/2009/11/pixelate-an-image-with-csharp/ ) but the namespace System.Drawing and Bitmap no longer exists.

Appreciate any thoughts!

You just scale it twice, one down with interpolation, and a second back up without any interpolation.

Just calculate the "pixel" (segment) size by dividing the width and height on the segment size. This will be your new temporary size you scale down to.

By using interpolation you will get an approximated average of the color value when scaling/resizing down. Turning off interpolation when scaling up will create blocks of solid colors for each pixel, ie.pixelated.

Use a pixel shader right in the xaml. This tutorial (although for silverlight) has a pixelate example:

http://msdn.microsoft.com/en-us/silverlight4trainingcourse_webcam_topic3.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM