110,537
社区成员
发帖
与我相关
我的任务
分享
string tempfilename = tempFolder + Guid.NewGuid().ToString() + ".jpg";//文件名
Image img = EditImage.Breviary(pic.Image, pic.Width, pic.Height);//生成缩略图,pic为PictureBox的Name
img.Save(tempfilename);//把缩略图保存到磁盘
pic.Image = img;
pic.ImageLocation = tempfilename;
img.Dispose();
GC.Collect();
//下面为加水印方法
EditImage.PicWaterMark(tempSrcImgPath, pic.Image, tempSavImgPath, pic.Location.X, pic.Location.Y);
Application.Run(new MainForm());
处抛异常 参数无效。。
//直接用pic的Image作为水印,则不出问题
EditImage.PicWaterMark(tempSrcImgPath, pic.Image, tempSavImgPath, pic.Location.X, pic.Location.Y);
string tempfilename = tempFolder + Guid.NewGuid().ToString() + ".jpg";
Image img = EditImage.Breviary(pic.Image, pic.Width, pic.Height);
img.Save(tempfilename);
img.Dispose();
GC.Collect();
//重新 new 一个Image,一样的错误
EditImage.PicWaterMark(tempSrcImgPath, Image.FromFile(tempfilename), tempSavImgPath, pic.Location.X, pic.Location.Y);
string tempfilename = tempFolder + Guid.NewGuid().ToString() + ".jpg";//文件名
Image img = EditImage.Breviary(pic.Image, pic.Width, pic.Height);//生成缩略图,pic为PictureBox的Name
img.Save(tempfilename);//把缩略图保存到磁盘
img.Dispose();
GC.Collect();
//这里改下..再用Image对象装入..然后用新的image去加水印
Image image = System.Drawing.Image.FromFile(tempfilename);
//pic.Image = img;
//pic.ImageLocation = tempfilename;
//下面为加水印方法....pic.Location.X你适当的改一下..
EditImage.PicWaterMark(tempSrcImgPath, image, tempSavImgPath, pic.Location.X, pic.Location.Y);