Reputation: 229
I am doing a Drawing App. I have saved the color fill image as bitmapImage in collection. Again I open the saved image for drawing. If i fill the color of image, the color filling not clear. I have used ExtensionJpg for save Image.
WriteableBitmap pBitmap;
pBitmap = new WriteableBitmap(imgDraw, null); // imgDraw is jpg image bitmapImage binded to source.
BitmapImage img1 = new BitmapImage();
MemoryStream ms = new MemoryStream();
pBitmap.SaveJpeg(ms, (int)pBitmap.PixelWidth, (int)pBitmap.PixelHeight, 0, 100);
img1.SetSource(ms);
In this case again i have binded the this bitmap Image to imgDraw Source. But to saw the image is very clear. When i fill colors to imgDraw is not applied correctly.
Thanks
Upvotes: 1
Views: 225
Reputation: 50682
When you encode a bitmap as a Jpeg file you can lose data. that is part of the design of lossy compression algorithms such as Jpeg.
Even worse, using a lossy compression can introduce (hardly visible) artifacts. So by saving the image as Jpeg you are probably adding pixels to the large, clear area. These pixels cause the fill to fail.
You have three options:
I noticed that you set the quality to 100 but this question makes me doubt the quality of the jpeg implementation of the method you might be using. You could switch to PNG to see if that helps.
Upvotes: 2