在没有GDI +的情况下,如何在WPF下将大图像更改/调整为小图像? [英] How to change/resizing a large image to small image under WPF without GDI+?

查看:104
本文介绍了在没有GDI +的情况下,如何在WPF下将大图像更改/调整为小图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

图像很大并在运行时加载,实际上我想在没有GDI +的WPF设施下将相同大小的图像调整为小图像.
换句话说,我有一个ImageBrush并在运行时在其ImageSource中将图像设置为大,因此我想将其大小调整为小.

任何帮助请...

在此先谢谢您.

Hi everybody,

The image is large and loaded it in run-time, actually I want resize selfsame to a small image under WPF facilities without GDI+.
In other words, I have an ImageBrush and set an image large in its ImageSource in run-time, so I want resizing it to small.

Any help pls...

Thanks in advance.

推荐答案

图像仍然是图像-所以像
构建ASP. NET缩略图图像生成器 [ WPF内存图像显示 [ RenderTargetBitmap [
An image is still an image - so things like
Build an ASP.NET Thumbnail Image Generator[^] provides the code required to create the thumbnail.

And then do something like WPF In-Memory Image Display[^]

You can also use RenderTargetBitmap[^]
public static BitmapSource CreateBitmapSourceFromVisual(double width, double height, Visual visual)
{
    if (visual == null)
    {
        return null;
    }
    RenderTargetBitmap bmp = new RenderTargetBitmap((Int32)Math.Ceiling(width),(Int32)Math.Ceiling(height),300,300,PixelFormats.Pbgra32);
 
    bmp.Render(visual);
    return bmp;
}





最好的问候
Espen Harlinn





Best regards
Espen Harlinn


这篇关于在没有GDI +的情况下,如何在WPF下将大图像更改/调整为小图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆