怎么遍历文件夹里的图片,然后给这些图片打水印呢

如何遍历文件夹里的图片,,然后给这些图片打水印呢
如何遍历文件夹里的图片,,然后给这些图片打水印呢
遍历文件夹里的图片,是用什么方法
谢谢了

------解决方案--------------------
system.io

判断文件扩展名

然后打开图片,在上面画图
------解决方案--------------------
缩略图水印组件wsImage3.5 批量加就可以
------解决方案--------------------
string extension = Path.GetExtension(File1.PostedFile.FileName).ToUpper();
string fileName = DateTime.Now.ToString( "yyyyMMddhhmmss ");

string path = Server.MapPath( ". ") + "/upload/ " + fileName + extension;
File1.PostedFile.SaveAs(path);
System.Drawing.Image image = System.Drawing.Image.FromFile(path);
System.Drawing.Image copyImage = System.Drawing.Image.FromFile( Server.MapPath( ". ") + "/logo.gif ");
//Create a new FrameDimension object from this image

FrameDimension ImgFrmDim = new FrameDimension( image.FrameDimensionsList[0] );

int nFrameCount = image.GetFrameCount( ImgFrmDim );

// Save every frame into jpeg format

for( int i = 0; i < nFrameCount; i++ )
{
image.SelectActiveFrame( ImgFrmDim, i );

image.Save( string.Format( Server.MapPath( ". ") + "/upload/Frame{0}.jpg ", i ), ImageFormat.Jpeg );
}
image.Dispose();

for( int i = 0; i < nFrameCount; i++ )
{
string pa = Server.MapPath( ". ") + "/upload/Frame "+i+ ".jpg ";
System.Drawing.Image Image = System.Drawing.Image.FromFile(pa);
Graphics g = Graphics.FromImage(Image);
g.DrawImage(copyImage, new Rectangle(Image.Width-copyImage.Width, Image.Height-copyImage.Height,

copyImage.Width, copyImage.Height), 0, 0, copyImage.Width, copyImage.Height, GraphicsUnit.Pixel);
g.Dispose();

string newPath = Server.MapPath( ". ") + "/upload/ " + fileName + "_new "+i.ToString()+ extension;
Image.Save(newPath);

Image.Dispose();

if(File.Exists(pa))
{
File.Delete(pa);
}


}


if(File.Exists(path))
{
File.Delete(path);
}


------解决方案--------------------
下面是遍历文件夹的代码

private void Page_Load(object sender, System.EventArgs e)
{
if (Session[ "UserName "] == null)
{
Response.Redirect( "login.aspx ");
}
DelFile();
// 在此处放置用户代码以初始化页面
string strdirlist = Request.QueryString.Get( "dir ");
string FileList,ImgFilePath,SysPath;
SysPath = "文件夹的虚拟路径 ";
if (strdirlist == null)
{
strdirlist = Server.MapPath(Application[ "UpLoadFilePath "].ToString());
}
ImgFilePath = strdirlist.Replace(SysPath, "../ ");
DirectoryInfo directory = null;
try
{
directory = new DirectoryInfo(strdirlist);
//读取目录属性
FileList = ( " <p> Creation: " + directory.CreationTime.ToString() + " </p> ");
if (!(strdirlist == null || strdirlist == Server.MapPath(Application[ "UpLoadFilePath "].ToString())))
{
FileList = FileList + " <ul> <li> <a href=\ "javascript:history.go(-1);\ "> ... </a> </li> </ul> ";
}

DirectoryInfo[] subDirectory = directory.GetDirectories();