本文整理汇总了C#中MagickImage.GetExifProfile方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.GetExifProfile方法的具体用法?C# MagickImage.GetExifProfile怎么用?C# MagickImage.GetExifProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MagickImage
的用法示例。
在下文中一共展示了MagickImage.GetExifProfile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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");
}
}
}
示例2: GetExifValue
//===========================================================================================
private static ExifValue GetExifValue()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
ExifProfile profile = image.GetExifProfile();
Assert.IsNotNull(profile);
return profile.Values.First();
}
}
示例3: Test_IEquatable
public void Test_IEquatable()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
ImageProfile first = image.GetExifProfile();
Assert.IsFalse(first == null);
Assert.IsFalse(first.Equals(null));
Assert.IsTrue(first.Equals(first));
Assert.IsTrue(first.Equals((object)first));
ImageProfile second = image.GetExifProfile();
Assert.IsNotNull(second);
Assert.IsTrue(first == second);
Assert.IsTrue(first.Equals(second));
Assert.IsTrue(first.Equals((object)second));
second = new EightBimProfile(new byte[] { 0 });
Assert.IsTrue(first != second);
Assert.IsFalse(first.Equals(second));
}
}
示例4: 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);
}
}
}
示例5: Test_Thumbnail
public void Test_Thumbnail()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
ExifProfile profile = image.GetExifProfile();
Assert.IsNotNull(profile);
using (MagickImage thumbnail = profile.CreateThumbnail())
{
Assert.IsNotNull(thumbnail);
Assert.AreEqual(128, thumbnail.Width);
Assert.AreEqual(85, thumbnail.Height);
Assert.AreEqual(MagickFormat.Jpeg, thumbnail.Format);
}
}
}
示例6: 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);
//.........这里部分代码省略.........
示例7: 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));
}
}
示例8: Test_ToByteArray
public void Test_ToByteArray()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
ImageProfile profile = image.GetExifProfile();
Assert.IsNotNull(profile);
Assert.AreEqual(4706, profile.ToByteArray().Length);
}
}
示例9: Test_Profile
public void Test_Profile()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
{
ImageProfile profile = image.GetExifProfile();
Assert.IsNotNull(profile);
image.RemoveProfile(profile.Name);
profile = image.GetExifProfile();
Assert.IsNull(profile);
using (MemoryStream memStream = new MemoryStream())
{
image.Write(memStream);
memStream.Position = 0;
using (MagickImage newImage = new MagickImage(memStream))
{
profile = newImage.GetExifProfile();
Assert.IsNull(profile);
}
}
}
}
示例10: Test_Ping
public void Test_Ping()
{
using (MagickImage image = new MagickImage())
{
image.Ping(Files.FujiFilmFinePixS1ProJPG);
ExceptionAssert.Throws<MagickCacheErrorException>(delegate()
{
image.GetReadOnlyPixels();
});
ImageProfile profile = image.GetExifProfile();
Assert.IsNotNull(profile);
}
}