本文整理汇总了C#中MagickImage.GetIptcProfile方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.GetIptcProfile方法的具体用法?C# MagickImage.GetIptcProfile怎么用?C# MagickImage.GetIptcProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MagickImage
的用法示例。
在下文中一共展示了MagickImage.GetIptcProfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetIptcValue
//===========================================================================================
private static IptcValue GetIptcValue()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
IptcProfile profile = image.GetIptcProfile();
return profile.Values.ElementAt(1);
}
}
示例2: Test_SetEncoding
public void Test_SetEncoding()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
IptcProfile profile = image.GetIptcProfile();
TestProfileValues(profile);
ExceptionAssert.Throws<ArgumentNullException>(delegate()
{
profile.SetEncoding(null);
});
profile.SetEncoding(Encoding.UTF8);
Assert.AreEqual(Encoding.UTF8, profile.Values.First().Encoding);
}
}
示例3: Test_SetValue
public void Test_SetValue()
{
using (MemoryStream memStream = new MemoryStream())
{
string credit = null;
for (int i = 0; i < 255; i++)
credit += i.ToString() + ".";
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
IptcProfile profile = image.GetIptcProfile();
TestProfileValues(profile);
IptcValue value = profile.GetValue(IptcTag.Title);
TestValue(value, "Communications");
profile.SetValue(IptcTag.Title, "Magick.NET Title");
TestValue(value, "Magick.NET Title");
value = profile.GetValue(IptcTag.Title);
TestValue(value, "Magick.NET Title");
value = profile.Values.FirstOrDefault(val => val.Tag == IptcTag.ReferenceNumber);
Assert.IsNull(value);
profile.SetValue(IptcTag.ReferenceNumber, "Magick.NET ReferenceNümber");
value = profile.GetValue(IptcTag.ReferenceNumber);
TestValue(value, "Magick.NET ReferenceNümber");
profile.SetValue(IptcTag.Credit, credit);
value = profile.GetValue(IptcTag.Credit);
TestValue(value, credit);
// Remove the 8bim profile so we can overwrite the iptc profile.
image.RemoveProfile("8bim");
image.AddProfile(profile);
image.Write(memStream);
memStream.Position = 0;
}
using (MagickImage image = new MagickImage(memStream))
{
IptcProfile profile = image.GetIptcProfile();
TestProfileValues(profile, 20);
IptcValue value = profile.GetValue(IptcTag.Title);
TestValue(value, "Magick.NET Title");
value = profile.GetValue(IptcTag.ReferenceNumber);
TestValue(value, "Magick.NET ReferenceNümber");
value = profile.GetValue(IptcTag.Credit);
TestValue(value, credit);
ExceptionAssert.Throws<ArgumentNullException>(delegate()
{
profile.SetValue(IptcTag.Caption, null, "Test");
});
profile.SetValue(IptcTag.Caption, "Test");
value = profile.Values.ElementAt(1);
Assert.AreEqual("Test", value.Value);
profile.SetValue(IptcTag.Caption, Encoding.UTF32, "Test");
Assert.AreEqual(Encoding.UTF32, value.Encoding);
Assert.AreEqual("Test", value.Value);
Assert.IsTrue(profile.RemoveValue(IptcTag.Caption));
Assert.IsFalse(profile.RemoveValue(IptcTag.Caption));
Assert.IsNull(profile.GetValue(IptcTag.Caption));
}
}
}
示例4: Test_Values
public void Test_Values()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
IptcProfile profile = image.GetIptcProfile();
TestProfileValues(profile);
using (MagickImage emptyImage = new MagickImage(Files.ImageMagickJPG))
{
Assert.IsNull(emptyImage.GetIptcProfile());
emptyImage.AddProfile(profile);
profile = emptyImage.GetIptcProfile();
TestProfileValues(profile);
}
}
}