3

Using sdk 3 , When i render a portrait picture taken from a Windows 10 mobile it appears stretched with wrong orientation . How to fix it ? Is it Os bug or Sdk bug ?

        m_image = new Lumia.Imaging.StorageFileImageSource(file);
        m_renderer = new SwapChainPanelRenderer(m_image, panel);
        await m_renderer.RenderAsync();   

sample

yannis
  • 67
  • 7

1 Answers1

1

It's true, there appears to be a bug in the Lumia Imaging SDK when it comes to EXIF orientation and rendering on GPU.

That said, there is an easy workaround. When you first load an IImageProvider from an StorageFile, make a temporray bitmap and use that as a source in your other rendering operations. That way you will only take the penalty of a CPU-only render operation once, in the most limited possible scenario. All your other rendering operations will the optimally GPU accelerated.

Here is a helper method to use when using a StorageFile as a source:

public static async Task<IImageProvider> CreateImageSourceFromFile(StorageFile file)
{
    using (var source = new StorageFileImageSource(file))
    using (var renderer = new BitmapRenderer(source) { RenderOptions = RenderOptions.Cpu })
    {
        var bitmap = await renderer.RenderAsync();
        return new BitmapImageSource(bitmap);
    }
}
David Božjak
  • 16,887
  • 18
  • 67
  • 98