public void Test_IptcProfile() { using (MagickImage input = new MagickImage(Files.MagickNETIconPNG)) { IptcProfile profile = input.GetIptcProfile(); Assert.IsNull(profile); profile = new IptcProfile(); profile.SetValue(IptcTag.Headline, "Magick.NET"); profile.SetValue(IptcTag.CopyrightNotice, "Copyright.NET"); input.AddProfile(profile); using (MemoryStream memStream = new MemoryStream()) { input.Format = MagickFormat.Tiff; input.Write(memStream); memStream.Position = 0; using (MagickImage output = new MagickImage(memStream)) { profile = output.GetIptcProfile(); Assert.IsNotNull(profile); TestValue(profile, IptcTag.Headline, "Magick.NET"); TestValue(profile, IptcTag.CopyrightNotice, "Copyright.NET"); } } } }
public bool Save(string rootpath) { bool success = false; ImageMagick.ExifProfile exifprofile = new ImageMagick.ExifProfile(); exifprofile.SetValue(ExifTag.Copyright, " ©" + Copyright); exifprofile.SetValue(ExifTag.Artist, Creator); exifprofile.SetValue(ExifTag.ImageDescription, Subject); exifprofile.SetValue(ExifTag.Software, Software); _image.AddProfile(exifprofile); ImageMagick.IptcProfile iptcprofile = new ImageMagick.IptcProfile(); iptcprofile.SetValue(IptcTag.CopyrightNotice, "No Unauthorized reproduction ©" + Copyright); iptcprofile.SetValue(IptcTag.Byline, Creator); iptcprofile.SetValue(IptcTag.Country, Country); iptcprofile.SetValue(IptcTag.Headline, Headline); iptcprofile.SetValue(IptcTag.Keyword, Keywords); iptcprofile.SetValue(IptcTag.Source, Source); iptcprofile.SetValue(IptcTag.Caption, Subject); iptcprofile.SetValue(IptcTag.Title, Title); _image.AddProfile(iptcprofile); _image.Write(rootpath); success = true; return(success); }
private static void TestProfileValues(IptcProfile profile, int count) { Assert.IsNotNull(profile); Assert.AreEqual(count, profile.Values.Count()); foreach (IptcValue value in profile.Values) { Assert.IsNotNull(value.Value); } }
public void Test_IEquatable() { using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG)) { ImageProfile first = image.GetIptcProfile(); Assert.IsFalse(first == null); Assert.IsFalse(first.Equals(null)); Assert.IsTrue(first.Equals(first)); Assert.IsTrue(first.Equals((object)first)); ImageProfile second = image.GetIptcProfile(); Assert.IsNotNull(second); Assert.IsTrue(first == second); Assert.IsTrue(first.Equals(second)); Assert.IsTrue(first.Equals((object)second)); second = new IptcProfile(new byte[] { 0 }); Assert.IsTrue(first != second); Assert.IsFalse(first.Equals(second)); } }
private static void TestValue(IptcProfile profile, IptcTag tag, string expectedValue) { IptcValue value = profile.GetValue(tag); Assert.IsNotNull(value); Assert.AreEqual(expectedValue, value.Value); }
private static void TestProfileValues(IptcProfile profile) { TestProfileValues(profile, 18); }