Quantcast
Channel: WriteableBitmapEx
Viewing all articles
Browse latest Browse all 360

New Post: Get Thumbnail image aspect ratio

$
0
0
Hello,
i have a jpg file saved in a isolated storage.
I would a thumbnail (200x200) from this jpeg keep aspect ratio

this is a my code
using (var isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        WriteableBitmap wb = BitmapFactory.New(0, 0);
                        wb.FromStream(isolatedStorage.OpenFile("1.jpg", FileMode.Open, FileAccess.Read));

                        IsolatedStorageFileStream fileStream= isolatedStorage.CreateFile("1_thumb.jpg");

                        float aspectRatio = (float)wb.PixelWidth / wb.PixelHeight;

                        wb.SaveJpeg(fileStream, 200, (int) (200 / aspectRatio), 0, 100);

                        fileStream.Close();
                        wb = null;

                    }
it is correct?

wb.PixelWidth and wb.PixelHeight is 0!!

thank you

Viewing all articles
Browse latest Browse all 360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>