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


C# MagickImage.AddProfile方法代码示例

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


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

示例1: Test_WithImage

		public void Test_WithImage()
		{
			using (MagickImage image = new MagickImage())
			{
				image.AddProfile(ColorProfile.USWebCoatedSWOP);
				ExceptionAssert.Throws<MagickResourceLimitErrorException>(delegate()
				{
					image.ColorSpace = ColorSpace.CMYK;
				});
				image.Read(Files.SnakewarePNG);

				ColorProfile profile = image.GetColorProfile();
				Assert.IsNull(profile);

				image.AddProfile(ColorProfile.SRGB);
				TestProfile(image.GetColorProfile(), "icc");
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:18,代码来源:ColorProfileTests.cs

示例2: Test_ICM

		public void Test_ICM()
		{
			using (MagickImage image = new MagickImage(Files.SnakewarePNG))
			{
				ColorProfile profile = image.GetColorProfile();
				Assert.IsNull(profile);

				image.AddProfile(new ImageProfile("icm", ColorProfile.SRGB.ToByteArray()));
				TestProfile(image.GetColorProfile(), "icc");
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:11,代码来源:ColorProfileTests.cs

示例3: 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.Get8BimProfile());
					emptyImage.AddProfile(profile);

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

示例4: Test_FromIXPathNavigable

		public void Test_FromIXPathNavigable()
		{
			using (MagickImage image = new MagickImage(Files.InvitationTif))
			{
				XmpProfile profile = image.GetXmpProfile();
				Assert.IsNotNull(profile);

				IXPathNavigable doc = profile.ToIXPathNavigable();

				ExceptionAssert.Throws<ArgumentNullException>(delegate()
				{
					XmpProfile.FromIXPathNavigable(null);
				});

				XmpProfile newProfile = XmpProfile.FromIXPathNavigable(doc);
				image.AddProfile(newProfile);

				doc = profile.ToIXPathNavigable();
				TestIXPathNavigable(doc);

				profile = image.GetXmpProfile();
				Assert.IsNotNull(profile);

				doc = profile.ToIXPathNavigable();
				TestIXPathNavigable(doc);

				Assert.AreEqual(profile, newProfile);
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:29,代码来源:XmpProfileTests.cs

示例5: Test_Constructor

		public void Test_Constructor()
		{
			using (MemoryStream memStream = new MemoryStream())
			{
				using (MagickImage image = new MagickImage(Files.ImageMagickJPG))
				{
					ExifProfile profile = image.GetExifProfile();
					Assert.IsNull(profile);

					profile = new ExifProfile();
					profile.SetValue(ExifTag.Copyright, "Dirk Lemstra");

					image.AddProfile(profile);

					profile = image.GetExifProfile();
					Assert.IsNotNull(profile);

					image.Write(memStream);
				}

				memStream.Position = 0;
				using (MagickImage image = new MagickImage(memStream))
				{
					ExifProfile profile = image.GetExifProfile();

					Assert.IsNotNull(profile);
					Assert.AreEqual(1, profile.Values.Count());

					ExifValue value = profile.Values.FirstOrDefault(val => val.Tag == ExifTag.Copyright);
					TestValue(value, "Dirk Lemstra");
				}
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:33,代码来源:ExifProfileTests.cs

示例6: Test_Values

		public void Test_Values()
		{
			using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
			{
				ExifProfile profile = image.GetExifProfile();
				TestProfile(profile);

				using (MagickImage emptyImage = new MagickImage(Files.ImageMagickJPG))
				{
					Assert.IsNull(emptyImage.GetExifProfile());
					emptyImage.AddProfile(profile);

					profile = emptyImage.GetExifProfile();
					TestProfile(profile);
				}
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:17,代码来源:ExifProfileTests.cs

示例7: Test_SetValue

		public void Test_SetValue()
		{
			double[] latitude = new double[] { 12.3, 4.56, 789.0 };

			using (MemoryStream memStream = new MemoryStream())
			{
				using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
				{
					ExifProfile profile = image.GetExifProfile();

					profile.SetValue(ExifTag.Software, "GraphicsMagick.NET");

					ExifValue value = profile.GetValue(ExifTag.Software);
					TestValue(value, "GraphicsMagick.NET");

					ExceptionAssert.Throws<ArgumentException>(delegate()
					{
						value.Value = 15;
					});

					profile.SetValue(ExifTag.ShutterSpeedValue, 75.55);

					value = profile.GetValue(ExifTag.ShutterSpeedValue);
					TestValue(value, 75.55);

					ExceptionAssert.Throws<ArgumentException>(delegate()
					{
						value.Value = 75;
					});

					profile.SetValue(ExifTag.XResolution, 150.0);

					value = profile.GetValue(ExifTag.XResolution);
					TestValue(value, 150.0);

					ExceptionAssert.Throws<ArgumentException>(delegate()
					{
						value.Value = "GraphicsMagick.NET";
					});

					image.Density = new MagickGeometry(72);

					value = profile.GetValue(ExifTag.XResolution);
					TestValue(value, 150.0);

					value = profile.GetValue(ExifTag.ReferenceBlackWhite);
					Assert.IsNotNull(value);

					profile.SetValue(ExifTag.ReferenceBlackWhite, null);

					value = profile.GetValue(ExifTag.ReferenceBlackWhite);
					TestValue(value, (string)null);

					profile.SetValue(ExifTag.GPSLatitude, latitude);

					value = profile.GetValue(ExifTag.GPSLatitude);
					TestValue(value, latitude);

					image.AddProfile(profile);

					image.Write(memStream);
				}

				memStream.Position = 0;
				using (MagickImage image = new MagickImage(memStream))
				{
					ExifProfile profile = image.GetExifProfile();

					Assert.IsNotNull(profile);
					Assert.AreEqual(43, profile.Values.Count());

					ExifValue value = profile.GetValue(ExifTag.Software);
					TestValue(value, "GraphicsMagick.NET");

					value = value = profile.GetValue(ExifTag.ShutterSpeedValue);
					TestValue(value, 75.55);

					value = value = profile.GetValue(ExifTag.XResolution);
					TestValue(value, 150.0);

					value = profile.GetValue(ExifTag.ReferenceBlackWhite);
					Assert.IsNull(value);

					value = profile.GetValue(ExifTag.GPSLatitude);
					TestValue(value, latitude);

					profile.Parts = ExifParts.ExifTags;

					image.AddProfile(profile);

					memStream.Position = 0;
					image.Write(memStream);
				}

				memStream.Position = 0;
				using (MagickImage image = new MagickImage(memStream))
				{
					ExifProfile profile = image.GetExifProfile();

					Assert.IsNotNull(profile);
//.........这里部分代码省略.........
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:101,代码来源:ExifProfileTests.cs

示例8: Test_Infinity

		public void Test_Infinity()
		{
			using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
			{
				ExifProfile profile = image.GetExifProfile();
				profile.SetValue(ExifTag.ExposureBiasValue, double.PositiveInfinity);
				image.AddProfile(profile);

				profile = image.GetExifProfile();
				ExifValue value = profile.GetValue(ExifTag.ExposureBiasValue);
				Assert.IsNotNull(value);
				Assert.IsTrue(double.PositiveInfinity.Equals(value.Value));

				profile.SetValue(ExifTag.ExposureBiasValue, double.NegativeInfinity);
				image.AddProfile(profile);

				profile = image.GetExifProfile();
				value = profile.GetValue(ExifTag.ExposureBiasValue);
				Assert.IsNotNull(value);
				Assert.IsTrue(double.NegativeInfinity.Equals(value.Value));

				profile.SetValue(ExifTag.FlashEnergy, double.NegativeInfinity);
				image.AddProfile(profile);

				profile = image.GetExifProfile();
				value = profile.GetValue(ExifTag.FlashEnergy);
				Assert.IsNotNull(value);
				Assert.IsTrue(double.PositiveInfinity.Equals(value.Value));
			}
		}
开发者ID:dlemstra,项目名称:GraphicsMagick.NET,代码行数:30,代码来源:ExifProfileTests.cs

示例9: Test_Values

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

				using (MagickImage emptyImage = new MagickImage(Files.ImageMagickJPG))
				{
					Assert.IsNull(emptyImage.Get8BimProfile());
					emptyImage.AddProfile(profile);

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

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


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