简体   繁体   中英

C#, Add watermark by using WebImage, the image quality was reduced

I am adding watermark to jpag file by using Webhelper.webImage. Here is the code:

var imgPath = HttpContext.Current.Server.MapPath(dirUser.FullPath + "/" + file.FileName);
WebImage sImage = new WebImage(imgPath);
sImage.AddTextWatermark("My Watermark", "White", 16, "Regular", "Verdana", "Right", "Bottom", 50, 5);
sImage.Save(imgPath);

After saving it, the image quality has been reduced too much, the original size is about 500K and the new image size is about 100K.. when checking the image property, the width, height, resolution (240 dpi) and bit depth are all same... don't know why the the image's size was reduced and also the quality is not good though... is there any option to add watermark and keep the same quality?

Thanks,

Patrick

JPEG是有损压缩,如果要进行无损压缩,则可以考虑使用PNG。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM