資源簡介
縮略圖、裁減縮略、打水印、高質量保存、色彩調整、馬賽克處理、銳化 、柔化、以逆時針為方向對圖像進行旋轉、圖片水印、文字水印、wmf格式處理

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Drawing;
using?System.Drawing.Drawing2D;
using?System.Drawing.Imaging;
using?System.IO;
namespace?ImageSaveRead
{
????public?static?class?IamgeReDraw
????{
????????#region?Image格式處理
????????///?
????????///?縮略圖,按高度和寬度來縮略?????????
????????///?
????????///?
????????///?
????????///?
????????public?static?Image?Scale(Image?image?Size?size)
????????{
????????????return?image.GetThumbnailImage(size.Width?size.Height?null?new?IntPtr());
????????}
????????///?
????????///?縮略圖,按倍數來縮略?????????
????????///?
????????///?原圖
????????///?放大或縮小的倍數,負數表示縮小,正數表示放大
????????///?
????????public?static?Image?Scale(Image?image?Int32?multiple)
????????{
????????????Int32?newWidth;
????????????Int32?newHeight;
????????????Int32?absMultiple?=?Math.Abs(multiple);
????????????if?(multiple?==?0)
????????????{
????????????????return?image.Clone()?as?Image;
????????????}
????????????if?(multiple?0)
????????????{
????????????????newWidth?=?image.Width?/?absMultiple;
????????????????newHeight?=?image.Height?/?absMultiple;
????????????}
????????????else
????????????{
????????????????newWidth?=?image.Width?*?absMultiple;
????????????????newHeight?=?image.Height?*?absMultiple;
????????????}
????????????return?image.GetThumbnailImage(newWidth?newHeight?null?new?IntPtr());
????????}
????????///?
????????///?固定寬度縮略?????????
????????///?
????????///?
????????///?
????????///?
????????public?static?Image?ScaleFixWidth(Image?image?Int32?width)
????????{
????????????Int32?newWidth?=?width;
????????????Int32?newHeight;
????????????Double?tempMultiple?=?(Double)newWidth?/?(Double)image.Width;
????????????newHeight?=?(Int32)(((Double)image.Height)?*?tempMultiple);
????????????Image?newImage?=?new?Bitmap(newWidth?newHeight);
????????????using?(Graphics?newGp?=?Graphics.FromImage(newImage))
????????????{
????????????????newGp.CompositingQuality?=?CompositingQuality.HighQuality;
????????????????//設置高質量插值法
????????????????newGp.InterpolationMode?=?System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
????????????????//設置高質量低速度呈現平滑程度
????????????????newGp.SmoothingMode?=?System.Drawing.Drawing2D.SmoothingMode.HighQuality;
????????????????//清空畫布并以透明背景色填充
????????????????newGp.Clear(Color.Transparent);
????????????????newGp.DrawImage(image?new?Rectangle(0?0?newWidth?newHeight));
????????????}
????????????return?newImage;
????????}
????????///?
????????///?固定高度縮略?????????
????????///?
????????///?
????????///?
????????///?
???
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????49793??2009-05-08?17:04??IamgeReDraw.cs
-----------?---------??----------?-----??----
????????????????49793????????????????????1
- 上一篇:c#五子棋游戲源代碼
- 下一篇:C#軟件注冊和注冊機的實現源碼
評論
共有 條評論