生成高清晰度的缩略图[方法1]
来源:互联网 发布:口碑好的淘宝女装店 编辑:程序博客网 时间:2024/04/29 09:00
public void pic_zero(string sourcepath,string aimpath,int scale)
{
string originalFilename =sourcepath;
//生成的高质量图片名称
string strGoodFile =aimpath;
//从文件取得图片对象
System.Drawing.Image image = System.Drawing.Image.FromFile(originalFilename);
int iImgWidth = image.Width;
int iImgHeight = image.Height;
int iScale = (iImgWidth / scale)>(iImgHeight/scale) ? (iImgWidth / scale) : (iImgHeight / scale);
//取得图片大小
System.Drawing.Size size = new Size(image.Width / iScale , image.Height / iScale);
//新建一个bmp图片
System.Drawing.Image bitmap = new System.Drawing.Bitmap(size.Width,size.Height);
//新建一个画板
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
//设置高质量插值法
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
//设置高质量,低速度呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//清空一下画布
g.Clear(Color.Blue);
//在指定位置画图
g.DrawImage(image, new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height),
new System.Drawing.Rectangle(0, 0, image.Width,image.Height),
System.Drawing.GraphicsUnit.Pixel);
//保存高清晰度的缩略图
bitmap.Save(strGoodFile, System.Drawing.Imaging.ImageFormat.Jpeg);
g.Dispose();
}
- 生成高清晰度的缩略图[方法1]
- 生成高清晰度的缩略图
- 使用MemoryStream动态生成清晰度高的缩略图
- java高品质缩略图生成方法,Jmagick使用1
- 生成缩略图+水印的方法
- NET生成缩略图的方法
- Android 生成缩略图的方法!!!
- php生成缩略图的方法
- Java生成高品质的缩略图
- 生成高清晰缩略图
- 生成高清晰缩略图
- 生成高清晰缩略图
- 生成高清晰缩略图
- 生成高质量缩略图
- 生成高质量缩略图
- asp.net 等比例生成上传图片的高质量缩略图的方法
- java高品质缩略图生成方法----Jmagick使用
- java高品质缩略图生成方法,Jmagick使用2
- 今年又快结束了
- 关于装softice2.7版出现蓝屏的问题!
- Jasper库和JPEG60比较
- 面试的经典问题
- Delphi制作GSM Modem的短信发送控件
- 生成高清晰度的缩略图[方法1]
- The role of JNDI in J2EE(FROM IBM)
- Windows Socket API 使用经验
- 上传图片并且生成可以控制大小图片清晰度的方法
- 为了一套房子你要奋斗多久?
- 读书计划
- .Net2.0中废弃的API
- 邮件系统使用的上传附件方法
- asp无组件上传类的应用实例