对于像我这样为 ImageResizer 糟糕的文档而苦苦挣扎的人,就添加水印文本而言,以下代码有效:
var c = Config.Current;
var wp = new WatermarkPlugin(); --> be sure to include
wp.Install(c); --> be sure to include
wp = c.Plugins.Get< WatermarkPlugin >(); -- be sure to include (ignore spaces in <>*)
var t = new TextLayer { Text = "Hello ", Fill = true };
var i = new ImageLayer(c);
const string dest = @"c:\tmp\Image16a.png";
var source = Server.MapPath("~/image.png");
wp.NamedWatermarks["img"] = new Layer[] { i };
wp.NamedWatermarks["text"] = new Layer[] { t };
c.CurrentImageBuilder.Build(source, dest, new ResizeSettings("watermark=text;name=John Doe"));
但是,如何允许用户选择放置文本水印的位置?同样,我在文档中找不到任何关于此的信息?