如何更改图像缩略图 [英] How to change Image Thumbnail
本文介绍了如何更改图像缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
事实上,我正在通过c#.net编写图像处理应用.
在这里,我根据其他图像制作一个图像.
这意味着我有一个图像,并且对其进行了一些更改然后再次保存",但是问题是图像的缩略图没有更改".像这样非常简单的代码:
hi all
as a matter of fact I''m writing an image processing app by c#.net.
here I make an image based on the other image .
it means that "I have an image and I make some changes on it and save it again" but the problem is "the thumbnail of image doesn''t change" . very simple code like this :
string strPath="c:\\bb.jpg",strMainPicPath="c:\\aa.jpg" ;
Image imgBase;
imgBase = Image.FromFile(strMainPicPath);
SolidBrush brush = new SolidBrush(cWhite);
Font fntB = new Font("tahoma", 8, FontStyle.Bold);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(imgBase);
g.DrawString("Test String", fntB, brush, 100, 100);
g.Dispose();
imgBase.Save(strPath, System.Drawing.Imaging.ImageFormat.Jpeg);
imgBase.Dispose();
问题只是图像的缩略图.
problem is just thumbnail of image .
推荐答案
这是非常糟糕的代码.始终使用using构造来强制处理对象.正如其他人所说,如果更改图像,还需要生成一个新的缩略图,这看起来很明显.
This is pretty bad code. Always use the using construct to force things to be disposed. As others have said, if you change your image, you also need to generate a new thumbnail, that seems obvious.
这篇关于如何更改图像缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文