当前位置: 首页>>代码示例>>C#>>正文


C# MagickImage.GetIptcProfile方法代码示例

本文整理汇总了C#中ImageMagick.MagickImage.GetIptcProfile方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.GetIptcProfile方法的具体用法?C# MagickImage.GetIptcProfile怎么用?C# MagickImage.GetIptcProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageMagick.MagickImage的用法示例。


在下文中一共展示了MagickImage.GetIptcProfile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_IptcProfile

    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");
          }
        }
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:29,代码来源:TiffTests.cs

示例2: GetIptcValue

 private static IptcValue GetIptcValue()
 {
   using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
   {
     IptcProfile profile = image.GetIptcProfile();
     return profile.Values.ElementAt(1);
   }
 }
开发者ID:levesque,项目名称:Magick.NET,代码行数:8,代码来源:IptcValueTests.cs

示例3: Test_ToByteArray

    public void Test_ToByteArray()
    {
      using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
      {
        ImageProfile profile = image.GetIptcProfile();
        Assert.IsNotNull(profile);

        Assert.AreEqual(273, profile.ToByteArray().Length);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:10,代码来源:ImageProfileTests.cs

示例4: Test_IEquatable

    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));
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:24,代码来源:ImageProfileTests.cs

示例5: 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);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:16,代码来源:IptcProfileTests.cs

示例6: Test_ClippingPaths

    public void Test_ClippingPaths()
    {
      using (MagickImage image = new MagickImage(Files.EightBimTIF))
      {
        EightBimProfile profile = image.Get8BimProfile();
        TestProfile(profile);

        using (MagickImage emptyImage = new MagickImage(Files.EightBimTIF))
        {
          emptyImage.Strip();
          Assert.IsNull(emptyImage.GetIptcProfile());
          emptyImage.AddProfile(profile);

          profile = emptyImage.Get8BimProfile();
          TestProfile(profile);
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:18,代码来源:EightBimProfileTests.cs

示例7: Test_SkipProfiles

    public void Test_SkipProfiles()
    {
      MagickReadSettings settings = new MagickReadSettings()
      {
        Defines = new JpegReadDefines()
        {
          SkipProfiles = ProfileTypes.Iptc | ProfileTypes.Icc
        }
      };

      using (MagickImage image = new MagickImage())
      {
        image.Read(Files.FujiFilmFinePixS1ProJPG);
        Assert.IsNotNull(image.GetIptcProfile());

        image.Read(Files.FujiFilmFinePixS1ProJPG, settings);
        Assert.IsNull(image.GetIptcProfile());
        Assert.AreEqual("Icc,Iptc", image.GetDefine(MagickFormat.Unknown, "profile:skip"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:20,代码来源:JpegReadDefinesTests.cs

示例8: 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, 19);

          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));
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:76,代码来源:IptcProfileTests.cs

示例9: 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);
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:17,代码来源:IptcProfileTests.cs

示例10: Test_Profile

    public void Test_Profile()
    {
      using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
      {
        ImageProfile profile = image.GetIptcProfile();
        Assert.IsNotNull(profile);
        image.RemoveProfile(profile.Name);
        profile = image.GetIptcProfile();
        Assert.IsNull(profile);

        using (MemoryStream memStream = new MemoryStream())
        {
          image.Write(memStream);
          memStream.Position = 0;

          using (MagickImage newImage = new MagickImage(memStream))
          {
            profile = newImage.GetIptcProfile();
            Assert.IsNull(profile);
          }
        }
      }
    }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:23,代码来源:MagickImageTests.cs


注:本文中的ImageMagick.MagickImage.GetIptcProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。