Saving DrawingVisual to an image file with a given DPI

后端 未结 3 557
感情败类
感情败类 2021-01-27 03:04

I have got a WPF application, and I would like to save a Canvas to a file with a correct DPI value. The Canvas size is the real physical size, eg. 20x10 cm, at 300 DPI, so it\'s

3条回答
  •  轮回少年
    2021-01-27 03:29

    I tried to apply DPI scaling to the DrawingVisual, but it produced less image quality. :( Also I tried to set the canvas to 756x378 (the 96 DPI size), then set the RenderTargetBitmap to 2362x1181 and 300 DPI, but that produced less image quality too. So, it seems any downscale then upscale or upscale then downscale are not the best solution. The DrawingVisual must be in the final render size.

提交回复
热议问题