Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resize an image in windows phone with out losing its quality

How I can resize an image in windows phone without losing its quality. I tried the below given method but the quality of the image fades in a fair margin. Can anyone update a better method for resizing my image.

            btmMap = new WriteableBitmap(biInput);
            var source = WriteableBitmapContextExtensions.GetBitmapContext(btmMap);
            btmMap = WriteableBitmapExtensions.Resize(btmMap, (int)imgWidth, (int)imgHeight,     WriteableBitmapExtensions.Interpolation.Bilinear);   

I also tried this method but the result is same :

                var wbOutput = PictureDecoder.DecodeJpeg(biInput, (int)imgWidth, (int)imgHeight);
                wbOutput.SaveJpeg(ms, wbOutput.PixelWidth, wbOutput.PixelHeight, 0, 100);
                ms.Seek(0, SeekOrigin.Begin);
                bmp.SetSource(ms);
                ms.FlushAsync();
like image 900
Nitha Paul Avatar asked Dec 01 '25 01:12

Nitha Paul


1 Answers

Download, reference and use 6.5 KB DLL from here for bicubic resizing. It produces better result than bilinear method in WriteableBitmapExtensions.

P.S. Excellent question! I've just updated my app to use better resizing method for generating images for my live tile.

like image 136
Soonts Avatar answered Dec 02 '25 22:12

Soonts



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!