日期:2014-05-19  浏览次数:20384 次

|M| 400分救命问题 求一个高质量的压缩图片不失真程序
void   GetThumbnailImage(int   width,   int   height,   string   strInfo,   int   left,   int   right,   string   filemane,   string   newfile)
        {
                string   file   =   "~/file/images/BB "   +   filemane;
                newfile   =   "~/file/images/ "   +   newfile;
                string   strAdd   =   strInfo;
                System.Drawing.Image   oldimage   =   System.Drawing.Image.FromFile(Server.MapPath(file));
                System.Drawing.Image   thumbnailImage   =
                oldimage.GetThumbnailImage(width,   height,   new   System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback),   IntPtr.Zero);
                Response.Clear();
                Bitmap   output   =   new   Bitmap(thumbnailImage);
                Graphics   g   =   Graphics.FromImage(output);
                g.DrawString(strAdd,   new   Font( "Courier   New ",   14),   new   SolidBrush(Color.Red),   left,   right);
                output.Save(Server.MapPath(newfile),   System.Drawing.Imaging.ImageFormat.Jpeg);
                Response.ContentType   =   "image/gif ";
                oldimage.Dispose();
        }
这是我的图片压缩程序
用来把800*600的图片压缩成320*240
但现在这个程序生成的图片和Photoshop压缩的图片相差实在是太多了,很是模糊
大家帮帮忙啊。网站都给别人了

------解决方案--------------------
保存为png格式。
------解决方案--------------------
到http://www.codeproject.com/useritems/ImageMagick_in_VBNET.asp,先认真看完Article,然后下载源码,把DLL引入使用.
------解决方案--------------------
哦,我知道你的意思了。不是保存质量的原因,而是在生成较小图片的原因。这样的话可以找找其它的运算方法。好像看过有人用win32 api操作生成。你也可以到msdn上找找