Having a bit of a problem creating a WritableBitmap and saving it being that WritableBitmap only seems to support JPEG. Obviously, this is quite an inconvenience and I really don't know what to do about it. How can I go about making my WritableBitmap save as a PNG file that supports Windows Phone 8.1 transparent tiles w/ background?
Note that i'm targeting 8.0.
My code:
private static void CreateBitmap(int width, int height)
{
WriteableBitmap b = new WriteableBitmap(width, height);
var canvas = new Grid();
canvas.Width = b.PixelWidth;
canvas.Height = b.PixelHeight;
var background = new Canvas();
background.Height = b.PixelHeight;
background.Width = b.PixelWidth;
// Removed this area of code which contains the design for my live tile.
b.Render(background, null);
b.Render(canvas, null);
b.Invalidate(); //Draw bitmap
using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream imageStream = new IsolatedStorageFileStream("/Shared/ShellContent/" + imagename + ".jpeg", System.IO.FileMode.Create, isf))
{
b.SaveJpeg(imageStream, b.PixelWidth, b.PixelHeight, 0, 100);
}
}
}