当前注册人数422990人 邮箱: 密码: 注册新用户 忘记密码
首页 C/C++/MFC C# ASP.NET VB.NET MATLAB Android   站内搜索 下载代码说明/积分规则
为什么要注册?

1. 可以直接免费从本站下载代码,防止邮件发送不到您的邮箱,或登录不了国外网站

2. 可以设定关键字,当有您关心的代码收录时,邮件通知您

3. 对这里的代码进行评分和评论

4. 可以和大家一起分享你的源代码,得到更多的建议

Image format Conversion, Overlay, Scale, Rotate, Reverse, mirror, Filp, Compress using GDI+

C#图像文件格式转换/旋转/缩放/左右上下翻转/镜像/重叠/压缩源代码

2008年02月27日
C#, Windows, .NET, .NET 1.0, .NET 1.1, VS, VS.NET2002, Dev
这个控件用GDI+实现,可以对读入的图像文件进行旋转(90度,180度,270度旋转),可以按比例缩放,或指定大小缩放,支持图像左右翻转,上下翻转/镜像,图像裁剪,支持多个图像文件重叠。可以压缩成JPEG,TIFF,GIF,PNG等格式,可选的压缩算法有CCITT3,CCITT4,LZW,RLE等等。图像文件可以从本地磁盘文件中或远程因特网上指定URL,直接获取。
相关知识
//Convert alpha to a 0..1 scale

float overlayAlphaFloat = (float)overlayAlpha / 100.0f;

//Copy the destination bitmap

//NOTE: Can't clone here, because if destBmp is indexed instead of just RGB,

//Graphics.FromImage will fail

Bitmap newBmp = new Bitmap(destBmp.Size.Width,
    destBmp.Size.Height);

//Create a graphics object attached to the bitmap

Graphics newBmpGraphics = Graphics.FromImage(newBmp);

//Draw the input bitmap into this new graphics object

newBmpGraphics.DrawImage(destBmp,
    new Rectangle(0, 0,
                destBmp.Size.Width,
                destBmp.Size.Height),
    0, 0, destBmp.Size.Width, destBmp.Size.Height,
    GraphicsUnit.Pixel);

//Create a new bitmap object the same size as the overlay bitmap

Bitmap overlayBmp = new Bitmap(bmpToOverlay.Size.Width, 
                                bmpToOverlay.Size.Height);

//Make overlayBmp transparent

overlayBmp.MakeTransparent(overlayBmp.GetPixel(0,0));

//Create a graphics object attached to the bitmap

Graphics overlayBmpGraphics = Graphics.FromImage(overlayBmp);
源代码原文下载:
A Bitmap Manipulation Class With Support For Format Conversion, Bitmap Retrieval from a URL, Overlays, etc. Provides an overview and discussion of the author's BitmapManipulator C# class, including examples of each feature, as well as numerous .NET/GDI+ caveats.

源码图片

点击链接查看大图
从本站下载附件及源代码(1个附件,已经成功下载1980次)

最值得关注的外文源代码

Clog - Client Logging, WPF Edition
Demo source code for image compression.
An example for jpeg compression and the restoration
Fast Image Rotation For .NET Compact Framework
评论(评论是增加积分的一个有效途径)
字数在300字内
请如实评论
本源代码共评论248次,此处显示最近20次评论! 查看所有评论

jim5488  2018年06月11日
very good, thanks
梅子黄时雨  2017年05月14日
很好的例子
寒露121  2017年03月23日
很好的例子
lrw2001@sina.com  2016年05月10日
感谢 学习
ord2011  2016年02月22日
能学下基本的图片操作,不错,谢谢分享!
what  2014年05月12日
感谢 学习
hefeng_aspnet  2013年09月04日
还没下
dlyhs  2013年08月28日
还没下,不知道呢
yangchun1213  2013年05月29日
hao ni mei
pingpong  2013年05月24日
Thank You!
ord2011  2013年05月17日
不错,学习,谢谢分享
reixuemin  2013年02月20日
不错,谢谢分享哦
lazychon149  2013年01月09日
不错,能学下基本的图片操作!
枫叶蓝林  2012年12月03日
正想要这样的资料!
yndxstxy2010jrsx  2012年11月03日
找到了
emoking  2012年10月26日
应该是不错的东西谢谢
zbxx631  2012年10月16日
谢谢,学习了
luliangjin  2012年09月22日
确实不错,能学下基本的图片操作!
cx4359481  2012年07月20日
谢谢分享
leoyangzg  2012年07月20日
确实不错,能学下基本的图片操作!
字数在300字内
请如实评论
200万国内源码搜索
CopyRight (C) codesoso.com 2007-2009 All Rights Reserved zhihuishi   免责声明