locked
Getting a thumbnail for a bitmap image from share charm

    Question

  • Hello,
    How can I get a thumbnail from bitmap image (which is stream)?
    Now my code looks like this:
     
    if (share.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.bitmap)) {
                    var bitmapStream = share.data.getBitmap(),
                    data = new FormData(),
                    imageBlob = msWWA.createBlobFromRandomAccessStream('image/bmp', bitmapStream)
                    _('img#image').src = URL.createObjectURL(imageBlob, false)
    
    I don't need to get a fullscreen image, I do want a thumbnail. Scaled fullscreen image looks ugly!
    Monday, January 30, 2012 2:14 PM

Answers

  • Hi Moushen,

    If there is no thumbnail provider available (like what some file types have) then you would need to create a thumbnail of your image yourself.  You might be able to render your image to a temporary image and scale that down, but I would think you would have the same scaling problems.  To test, save a your full screen image and try scaling using HTML techniques to see if this is even going to give you what you want.  If it is, then you could use that image to create a stream and apply that as your thumbnail per the quickstart link above.

    PS:  You can try different interpolation modes on the image to see if one looks better than the other:

    http://msdn.microsoft.com/en-us/library/ie/ms530822(v=vs.85).aspx

     

     

    -Jeff


    Jeff Sanders (MSFT)
    Tuesday, January 31, 2012 7:59 PM
    Moderator

All replies