这张照片的另一六张图片组成的照片墙谁知道

杩涓璇ユ瀛ㄧ浣缃瀵广娌℃瀛扮稿浠ュㄨ婧绠$ㄦ剧绉诲ㄥ扮稿锛ユㄥ绛澶婊℃璇风瑰讳光濂借锛璋㈣阿ㄧ绾炽锛2325人阅读
主要利用://在指定位置画图
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);
image:你的原图,
System.Drawing.Rectangle:位置与长宽,根据自己需要设置!
--------------------------------------------------------------------------------------------------------------
public void MakeSmallImg(string filePath, string saveImg)
//从文件取得图片对象
System.Drawing.Image image = System.Drawing.Image.FromFile(filePath, true);
//取得图片大小
System.Drawing.Size size = new System.Drawing.Size((int)image.Width, (int)image.Height);
//新建一个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.D
//设置高质量,低速度呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.D
//清空一下画布
g.Clear(System.Drawing.Color.White);
//在指定位置画图
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);
///文字水印
//System.Drawing.Graphics G=System.Drawing.Graphics.FromImage(bitmap);
//System.Drawing.Font f=new Font(&宋体&,10);
//System.Drawing.Brush b=new SolidBrush(Color.Black);
//G.DrawString(&myohmine&,f,b,10,10);
//G.Dispose();
///图片水印
//System.Drawing.Image copyImage = System.Drawing.Image.FromFile(System.Web.HttpContext.Current.Server.MapPath(&pic/1.gif&));
//Graphics a = Graphics.FromImage(bitmap);
//a.DrawImage(copyImage, new Rectangle(bitmap.Width-copyImage.Width,bitmap.Height-copyImage.Height,copyImage.Width, copyImage.Height),0,0, copyImage.Width, copyImage.Height, GraphicsUnit.Pixel);
//copyImage.Dispose();
//a.Dispose();
//copyImage.Dispose();
//保存高清晰度的缩略图
bitmap.Save(strGoodFile, System.Drawing.Imaging.ImageFormat.Jpeg);
加个a表示是缩略图
bitmap.Save(saveImg, System.Drawing.Imaging.ImageFormat.Jpeg);
g.Dispose();
image.Dispose();
bitmap.Dispose();
=====================================================
c#缩小图片后不清晰,要怎么缩小才能跟原来一样清晰。我用:System.Drawing.Bitmap缩小的。
正好之前有写过这个,不过是用的.net自带的api写的,如果想要弄的很好的话非常难,有兴趣可以看一下插值法,有若干种办法不一一列举。
/// &summary&
/// 获取缩小后的图片
/// &/summary&
/// &param name=&bm&&要缩小的图片&/param&
/// &param name=&times&&要缩小的倍数&/param&
/// &returns&&/returns&
private Bitmap GetSmall(Bitmap bm, double times)
int nowWidth = (int)(bm.Width / times);
int nowHeight = (int)(bm.Height / times);
Bitmap newbm = new Bitmap(nowWidth, nowHeight);//新建一个放大后大小的图片
if (times &= 1 && times &= 1.1)
Graphics g = Graphics.FromImage(newbm);
g.InterpolationMode = InterpolationMode.HighQualityB
g.SmoothingMode = SmoothingMode.HighQ
g.CompositingQuality = CompositingQuality.HighQ
g.DrawImage(bm, new Rectangle(0, 0, nowWidth, nowHeight), new Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pixel);
g.Dispose();
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:478354次
积分:5963
积分:5963
排名:第2322名
原创:17篇
转载:914篇
评论:33条
(3)(18)(26)(25)(4)(11)(17)(9)(25)(13)(34)(9)(2)(6)(12)(4)(20)(25)(36)(24)(18)(9)(6)(13)(3)(12)(4)(11)(3)(1)(4)(3)(4)(9)(5)(5)(20)(5)(5)(14)(10)(45)(81)(117)(7)(3)(23)(20)(105)(45)

我要回帖

更多关于 谁知道那样的图片网站 的文章

 

随机推荐