Windows-8.1

How to Save a Transparent or a .png image file in Isolated Storage of Windows phone app

This is a small blog post in which I shall explain you how to save a transparent or a .png image file in isolated storage of Windows phone app.

By default you can save a WriteableBitmap object as .jpeg image file in the isolated storage of your application using SaveJpeg method.

But you can easily add an extension to it and provide a .png method of saving the images.

 

You will have to follow certain steps given below to add this extension to your project

 

Step1:
Add two external references (packages) to your project. They are

1) SharpZipLib-WP7

2) WriteableBitmapEx

 


 

If you don’t know how to add a reference to your project you can refer to the following blog post.

http://www.windowsapptutorials.com/windows-phone/how-to-integrate-a-toolkit-or-third-party-sdk-with-windows-phone-app-using-nuget-package-manager-2/

 

Step2:
Add the following class to your project.

PngChunkTypes.cs

 


 

After you have completed the above two steps. You will be provided with some additional methods for the WriteableBitmap object which are Writepng and Setsource. Using these two methods you can save a .png format file in the isolated storage of your Windows phone app.

A small example has been given below

 

 

I hope this post will be helpful to you.

 

 


Chetan Gulati

Currently am doing B TECH in IT from Delhi Technological University. App development is my passion. Believe in quality rather than quantity.

  • stipe

    This is old stuff. What about Windows Phone 8.1 RT?

Read more:
How to create your first Windows Phone app
How to change the App name and Tile name of your Windows phone app
Data binding in Windows Phone app – One way binding
Close