您的位置:程序门 -> .net技术 -> c#



c# 操作图片问题,高手帮忙


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


c# 操作图片问题,高手帮忙[已结贴,结贴人:pumaadamsjack]
发表于:2007-01-24 08:53:57 楼主
string   path1   =   textbox1.text;
                        string   path2   =   textbox2.text;
                        image   newimage   =   image.fromfile(path1);

                        bitmap   map   =   new   bitmap(60,84);

                       
                        graphics   yy   =   graphics.fromimage(map);
                       
                        yy.drawimage(newimage,   new   rectangle(0,   0,   60,   84));

                     
                        map.save(path2);
这就是我简单得代码,目的是把一个   120x160   的图片变成   60x84的图片
以上代码可以完成变换,变完是60x84,可我变换的目的是为了图片体积变小,结果图片在变以前   120x160   这个是   11.4kb   变成     60x84     反而变成12.5kb了,郁闷,各位给看看吧,多谢了!!

发表于:2007-01-24 09:02:501楼 得分:5
注意文件格式
保存成jpg试试.
发表于:2007-01-24 09:14:462楼 得分:5
应试与格式无关
你用graphics重画了
试试用其他方法
发表于:2007-01-24 09:21:163楼 得分:10
yy.compositingquality=compositingquality.highspeed;
yy.smoothingmode=smoothingmode.highspeed;
yy.interpolationmode=interpolationmode.nearestneighbor;

把质量设置低一些看看
发表于:2007-01-24 09:33:054楼 得分:0
回复人:htcml(htht)   (

变化了一下   从   12.1变成了11.9   ,不过变化很小啊


快速检索

最新资讯
热门点击