locked
Save full-resolution image data in a Direct2D + XAML App

    Question

  • Hi all,

    I go through several samples and forum threads about DirectX+XAML app, mostly regarding load photo file, add DirectX effect, then save the D2D1Bitmap to a new photo file. All of them work well. My question is, it seems to me that if a photo file is loaded to a DirectX surface and transformed, the only data I can get to save is the surface size (or the screen size and screen resolution.)

    Is there a way to save original size/resolution of photo data even after transformed? (that is, I can load a photo 4000x4000, transformed by brightness effect, then save it as a new file in 4000x4000 pixel. For now, I can get the D2D1Bitmap which is my screen resolution.)

    Regards,

    Alex

    Saturday, June 30, 2012 5:44 PM

Answers

  • I should read the document more, I find that is can be obtained by ID2D1Effect::GetOutput(); to get ID2D1Image.

    --

    • Marked as answer by alexhuang888 Tuesday, July 17, 2012 11:21 PM
    Tuesday, July 17, 2012 11:21 PM

All replies


  • Hello,

    I think you can follow this sample code
    Direct2D save to image file sample
    http://code.msdn.microsoft.com/windowsapps/SaveAsImageFile-68073cb0

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 2, 2012 8:10 AM
    Moderator
  • Hi Jesse,

    Thanks for reply. I did follow this sample and can save ID2D1Bitmap to file by using WIC. However, the bitmap is actually always the screen size, I think that is because it is from DirectX display surface.

    What I'm working on is like the samples http://code.msdn.microsoft.com/windowsapps/Direct2D-Image-Effects-2979be08

    I can load a large jpeg and apply effect. That is, now I have a ID2D1Effect interface and would like to save it to image file, is it doable in WIC?

    I read the message in http://msdn.microsoft.com/en-us/library/windows/desktop/hh994451(v=vs.85).aspx

    It says that

    Prerequisites

    In the example you provide, I can use WIC to save ID2D1Bitmap by IWICBitmapEncoder::WriteFrame(ID2D1Bitmap*, ...); to make it. But I now may need to use ID2D1Effect as the frame source.

    So, the question is:

    1. In WIC, can it accept ID2D1Effect as a frame source then encode to an image file?

    2. Or, Is there any property or method can get ID2D1Bitmap from ID2D1Effect?

    Thanks for your time.

    Regards

    Alex

    Tuesday, July 3, 2012 3:53 AM
  • ID2D1Effect does not implement ID2D1Image, anyone know how to make it as "Prerequisites" claims? Or, is this not the right board to post this question?

    --

    Tuesday, July 17, 2012 6:54 PM
  • I should read the document more, I find that is can be obtained by ID2D1Effect::GetOutput(); to get ID2D1Image.

    --

    • Marked as answer by alexhuang888 Tuesday, July 17, 2012 11:21 PM
    Tuesday, July 17, 2012 11:21 PM