locked
Howto save a BitmapImage

    Question

  • Although I looked at similar question, my specific problem does not not seem to be posted on this forum.

    Given an in-memory BitmapImage without a backing file or stream, I want to save this image to disk.

    How can I do this? I've looked at all image related classes but didn't find a solution, mainly because BitmapImage does not allow access to it's internal data.

    Wednesday, April 09, 2014 10:14 PM

Answers

  • This *might* help. It's a method I use to save a UI control to a bitmap file.

    Note: This is 8.1 only - I couldn't find a way to do this in 8.0, and my code is in VB.

    Save UI control as a bitmap


    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

    Wednesday, April 09, 2014 10:42 PM
  • Right. To save the data out you need to use a WriteableBitmap instead of a BitmapImage. They are both BitmapSources and so can be used interchangeably in almost all other cases.

    The other option is what Pumpkinszwan suggests: like other UIElements on Windows 8.1 you can render the element to a bitmap with the RenderTargetBitmap class

    --Rob

    Wednesday, April 09, 2014 11:13 PM
    Owner

All replies

  • This *might* help. It's a method I use to save a UI control to a bitmap file.

    Note: This is 8.1 only - I couldn't find a way to do this in 8.0, and my code is in VB.

    Save UI control as a bitmap


    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

    Wednesday, April 09, 2014 10:42 PM
  • Right. To save the data out you need to use a WriteableBitmap instead of a BitmapImage. They are both BitmapSources and so can be used interchangeably in almost all other cases.

    The other option is what Pumpkinszwan suggests: like other UIElements on Windows 8.1 you can render the element to a bitmap with the RenderTargetBitmap class

    --Rob

    Wednesday, April 09, 2014 11:13 PM
    Owner