Decoding a jpg in the background in WP7
Posted
by
Shahar Prish
on Stack Overflow
See other posts from Stack Overflow
or by Shahar Prish
Published on 2012-03-27T17:25:51Z
Indexed on
2012/03/27
17:30 UTC
Read the original article
Hit count: 294
I have a bunch of apps in the marketplace, and so far I have been able, by changing my functionality or going the extra mile, to work around the issue of being unable to decode a jpg in the background into a WriteableBitmap.
I am finding a situation where I can't think of good ways to "work around" the issue. I need to decode the image I get from MediaLibrary, reduce it's resolution to something managable (800x800), rotate it potentially and save to local storage. By far, the thing that takes the most time (80%) is decoding the bitmap to 800x800 - it takes between 700ms to 1000 ms. A user may add 7-10 images when starting, which translates to ~10 seconds of waiting for the images being added.
I tried doing this lazily, but at some point you need to pay the piper and the app essentially stutters for ~1000ms at that point and the experience is not great.
Is there an alternative I am missing for loading the image in the background somehow?
(Note on why CreateOptions.BackgroundCreation is no good for me: It loads the image into a BitmapImage which is great if you want to just use it, but not so great for what I need to do which is create a copy in Isolated Storage).
© Stack Overflow or respective owner