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


C# MagickImage.AutoOrient方法代码示例

本文整理汇总了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;
        }
开发者ID:btugade,项目名称:digiCamControl,代码行数:29,代码来源:RotateTransform.cs

示例2: ExecuteAutoOrient

 private static void ExecuteAutoOrient(MagickImage image)
 {
   image.AutoOrient();
 }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:4,代码来源:MagickImage.cs

示例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();
            }
        }
开发者ID:dynamicdeploy,项目名称:ReceiptOCR,代码行数:68,代码来源:Form1.cs

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


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