使用Solid Framework调整位图大小 [英] Bitmap Resize using solid Framework

查看:63
本文介绍了使用Solid Framework调整位图大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用Solid Framework将pdf转换为图像,
所以我们有一种方法叫做位图bm = page.DrawBitmap(dpi);"
创建位图图像,但是我需要以编程方式调整图像的大小,但是此方法仅返回默认图像大小,请帮助我..
在此先感谢

Hi all,

I am using Solid Framework to convert pdf to image,
so we have one method called " Bitmap bm = page.DrawBitmap(dpi);"
to create the Bitmap image, But i need to resize the image programatically, But this method only return the Default image size, Please help me..
Thanks in advance

推荐答案

您可以轻松调整从page.DrawBitmap(dpi);获得的图像的大小.
这是为您提供的简单示例:
You can easily resize the image which you get from page.DrawBitmap(dpi);.
Here is a quick example for you:
public static Bitmap ResizeImage(Image image, int width, int height)
{
    // We will draw resized image on this bitmap
    Bitmap result = new Bitmap(width, height);
    
    // We will use a graphics object to draw the resized image into the bitmap
    using (Graphics graphics = Graphics.FromImage(result))
    {
         // Set the quality modes to high quality.
         // You can change this modes if the speed is more important in your case
         graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality;
         graphics.CompositingQuality = Drawing2D.CompositingQuality.HighQuality;
         graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic;

         // Draw the image into the target bitmap
         graphics.DrawImage(image, 0, 0, result.Width, result.Height);
    }

    // Return the resized bitmap
    return result;
}



刚经过图像和所需的尺寸(宽度和高度)即可使用此功能.它将为您返回调整大小的图像. :)

我希望这有帮助. :)

问候



Just past the image and desired dimensions(width and height) to this function. It will return a resized image for you. :)

I hope this helps. :)

Regards


这篇关于使用Solid Framework调整位图大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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