本文整理汇总了C#中ImageMagick.MagickImage.AutoOrient方法的典型用法代码示例。如果您正苦于以下问题:C# MagickImage.AutoOrient方法的具体用法?C# MagickImage.AutoOrient怎么用?C# MagickImage.AutoOrient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageMagick.MagickImage
的用法示例。
在下文中一共展示了MagickImage.AutoOrient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
{
var conf = new RotateTransformViewModel(configData);
// Read from file
using (MagickImage image = new MagickImage(infile))
{
image.BackgroundColor = new MagickColor(Color.Black);
if (conf.AutoRotate)
{
ExifProfile profile = image.GetExifProfile();
image.AutoOrient();
profile.SetValue(ExifTag.Orientation, (UInt16)0);
}
if (conf.Angle > 0)
image.Rotate(conf.Angle);
if(conf.FlipHorizontal)
image.Flop();
if (conf.FlipVertical)
image.Flip();
image.Format = MagickFormat.Jpeg;
// Save the result
image.Write(dest);
}
return dest;
}
示例2: ExecuteAutoOrient
private static void ExecuteAutoOrient(MagickImage image)
{
image.AutoOrient();
}
示例3: processImgForScanning
private Bitmap processImgForScanning(Bitmap imgInput)
{
using (MemoryStream memstream = new MemoryStream())
{
imgInput.Save(memstream, ImageFormat.Tiff);
MagickImage img = new MagickImage(memstream.ToArray());
if (sharpen)
{
img.Sharpen((int)sharpenIntX.Value, (int)sharpenIntY.Value, Channels.All);
}
if (autoGamma)
{
img.AutoGamma();
}
if (enhance)
{
img.Enhance();
}
if (contrast)
{
img.Contrast();
}
if (autoLevel)
{
img.AutoLevel();
}
if (autoOrient)
{
img.AutoOrient();
}
if (despeckle)
{
img.Despeckle();
}
if (medianFilter)
{
img.MedianFilter((int)medianInt.Value);
}
if (unsharpmask)
{
img.Unsharpmask(6.8, 4, 4,0);
}
if (wtThreshold)
{
img.LinearStretch((float)0.9, 0.1);
//img.WhiteThreshold((int)wtThresInt.Value);
//img.ReduceNoise();
//img.Grayscale(PixelIntensityMethod.Brightness);
}
if (invert)
{
img.Negate();
}
return img.ToBitmap();
}
}
示例4: Test_AutoOrient
public void Test_AutoOrient()
{
using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProPNG))
{
Assert.AreEqual(600, image.Width);
Assert.AreEqual(400, image.Height);
Assert.AreEqual(OrientationType.TopLeft, image.Orientation);
ExifProfile profile = image.GetExifProfile();
profile.SetValue(ExifTag.Orientation, (ushort)6);
image.AddProfile(profile);
using (MemoryStream memStream = new MemoryStream())
{
image.Write(memStream);
memStream.Position = 0;
image.Read(memStream);
Assert.AreEqual(600, image.Width);
Assert.AreEqual(400, image.Height);
Assert.AreEqual(OrientationType.RightTop, image.Orientation);
image.AutoOrient();
Assert.AreEqual(400, image.Width);
Assert.AreEqual(600, image.Height);
Assert.AreEqual(OrientationType.TopLeft, image.Orientation);
}
}
}