How to change image color in windows store app ? RRS feed

  • Question

  • I've looked at WritableBitmap but didn't succeed ,can anyone please provide at least sample code on how to do this .Thanks   


    Monday, September 29, 2014 10:18 AM


All replies

  • What exactlly are you trying to do? WriteableBitmap gives you direct read/write access to data of each pixel. Are you trying to e.g. give a red tint to a black/white image?
    Monday, September 29, 2014 12:56 PM
  • I am try to change an image of a red color to any selected color .


    Monday, September 29, 2014 1:02 PM
  • Well, theoretically you can loop through all pixels in the image using a WriteableBitmap, check if the pixel is red and replace it with the Color you want. The question is wether all pixels that are red have the same shade of red?

    Are the remaining pixels black or white or some other color?

    Monday, September 29, 2014 1:17 PM
  • remaining pixels are white


    Monday, September 29, 2014 1:26 PM
  • There's a code snippet to walk through the pixels and change colors at http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/2909fc75-f519-4d6f-a968-3ca350c9e6be/

    For your case I'd probability look at each 4-byte pixel as a unit(rather than each better)

    convert it to hue and the pick a range of reds.

    Monday, September 29, 2014 3:15 PM
  • I've tried that and i cant get it to work because some of the methods does not exit in windows 8.1 ,is there any working sample that supports windows 8.1 ? 


    Tuesday, September 30, 2014 6:24 AM
  • The code in the linked thread is for Windows 8.1.

    You may not have all of the namespaces included in your usings. See Visual Studio's Red Squigglies .

    Tuesday, September 30, 2014 3:31 PM