Class that can be used to access an Iptc profile.
Inheritance: ImageProfile
Example #1
0
    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");
          }
        }
      }
    }
Example #2
0
    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);
      }
    }
Example #3
0
    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));
      }
    }
Example #4
0
 private static void TestValue(IptcProfile profile, IptcTag tag, string expectedValue)
 {
   IptcValue value = profile.GetValue(tag);
   Assert.IsNotNull(value);
   Assert.AreEqual(expectedValue, value.Value);
 }
Example #5
0
 private static void TestProfileValues(IptcProfile profile)
 {
   TestProfileValues(profile, 18);
 }