本文整理汇总了C#中ImageMagick.MagickImage.SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.SetAttribute方法的具体用法?C# MagickImage.SetAttribute怎么用?C# MagickImage.SetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.SetAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Attribute
public void Test_Attribute()
{
using (MagickImage image = new MagickImage(Files.ImageMagickJPG))
{
Assert.IsNull(image.GetAttribute("test"));
IEnumerable<string> names = image.AttributeNames;
Assert.AreEqual(4, names.Count());
image.SetAttribute("test", "");
Assert.AreEqual(null, image.GetAttribute("test"));
image.SetAttribute("test", "123");
Assert.AreEqual("123", image.GetAttribute("test"));
image.SetArtifact("foo", "bar");
names = image.AttributeNames;
Assert.AreEqual(5, names.Count());
Assert.AreEqual("date:create,date:modify,jpeg:colorspace,jpeg:sampling-factor,test", string.Join(",", (from name in names
orderby name
select name).ToArray()));
}
}
示例2: ExecuteSetAttribute
private void ExecuteSetAttribute(XmlElement element, MagickImage image)
{
String name_ = Variables.GetValue<String>(element, "name");
String value_ = Variables.GetValue<String>(element, "value");
image.SetAttribute(name_, value_);
}
示例3: Test_Artifact
public void Test_Artifact()
{
using (MagickImage image = new MagickImage(Files.SnakewarePNG))
{
Assert.IsNull(image.GetArtifact("test"));
image.SetArtifact("test", "");
Assert.AreEqual(null, image.GetArtifact("test"));
image.SetArtifact("test", "123");
Assert.AreEqual("123", image.GetArtifact("test"));
image.SetAttribute("foo", "bar");
IEnumerable<string> names = image.ArtifactNames;
Assert.AreEqual(1, names.Count());
Assert.AreEqual("test", string.Join(",", (from name in names
orderby name
select name).ToArray()));
}
}