Search code examples
c#savepngwindows-phone

How do I save WriteableBitmap as png image with transparency


I crop the circular area from the image for the avatar. I need to get pixels byte[] of the image and upload to the server in base64 format. Unfortunately method SaveJpeg() does not support transparency pixels outside the selected circle. I tried ImageTools library, but no other platform except WindowsPhone unable to create png image from the resulting byte[]. Is there a way to do this?


Solution

  • There is no platform API to do this. The ToolStack PNG library presents a lightweight solution.

    http://toolstack.com/libraries/pngwriter