最有效的方法水印图像C#飞? [英] Most Efficient Way To Watermark Image C# On The Fly?

查看:151
本文介绍了最有效的方法水印图像C#飞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我都内置了asp.net C#(Web表单)的电子商务商店和大量新产品的图像是非常困难的来源,所以我想我们的商标或域名水印它们。

I have an ecommerce store built in asp.net c# (Webforms) and a lot of the new product images are very hard to source, so I'd like to watermark them with our logo or domain name.

有太多的产品,只是下载图像,并添加水印,以及用户使用有限的图像编辑经验者上传新的(所以他们不会有线索如何添加水印)。

There are too many products to just download the images and add the watermark, and users with limited image editing experience will be uploading new ones (So they won't have a clue how to add the watermark).

所以我想这只是我留下了使用的HttpHandler?是/否?如果是这样,你可以提供一些见解(preferably $在C#C $ C示例)到最有效的方法添加水印,考虑有些网页将有大约20幅图像(JPEG格式)上(所有这一切都需要进行水印)

So I guess this just leaves me with using a HttpHandler? Yes / No? If so can you provide some insight (Preferably code samples in C#) into the most efficient way of adding the watermark, considering some pages will have around 20 images (Jpegs) on (All of which need to be watermarked)

推荐答案

我会得到图形对象为JPEG,然后绘制关于该项目的顶部水印,并与水印重新保存:

I would obtain the Graphicsobject to the jpeg, and then draw the watermark on top of that item, and save it again with the watermark:

using (Image image = Image.FromFile("myImage.jpg"))
using(Graphics g = Graphics.FromImage( image)){
  g.DrawImage( myWaterMarkImage, myPosition);
  image.Save(myFilename);
}

这篇关于最有效的方法水印图像C#飞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆