SetValue() public method

Sets the value of the specified tag.
public SetValue ( IptcTag tag, Encoding encoding, string value ) : void
tag IptcTag The tag of the iptc value.
encoding System.Text.Encoding The encoding to use when storing the bytes.
value string The value.
return void
Example #1
1
    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
        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);
        }