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


C# MagickImageCollection.AppendHorizontally方法代码示例

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


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

示例1: ConvertPDFTOneImage

    public static void ConvertPDFTOneImage()
    {
      MagickReadSettings settings = new MagickReadSettings();
      // Settings the density to 300 dpi will create an image with a better quality
      settings.Density = new PointD(300, 300);

      using (MagickImageCollection images = new MagickImageCollection())
      {
        // Add all the pages of the pdf file to the collection
        images.Read(SampleFiles.SnakewarePdf, settings);

        // Create new image that appends all the pages horizontally
        using (MagickImage horizontal = images.AppendHorizontally())
        {
          // Save result as a png
          horizontal.Write(SampleFiles.OutputDirectory + "Snakeware.horizontal.png");
        }

        // Create new image that appends all the pages horizontally
        using (MagickImage vertical = images.AppendVertically())
        {
          // Save result as a png
          vertical.Write(SampleFiles.OutputDirectory + "Snakeware.vertical.png");
        }
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:26,代码来源:ConvertPDF.cs

示例2: CreatePallete

    private MagickImage CreatePallete()
    {
      using (MagickImageCollection images = new MagickImageCollection())
      {
        images.Add(new MagickImage(MagickColors.Red, 1, 1));
        images.Add(new MagickImage(MagickColors.Blue, 1, 1));
        images.Add(new MagickImage(MagickColors.Green, 1, 1));

        return images.AppendHorizontally();
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:11,代码来源:MagickImageTests.cs

示例3: Test_Append

    public void Test_Append()
    {
      int width = 70;
      int height = 46;

      using (MagickImageCollection collection = new MagickImageCollection(Files.RoseSparkleGIF))
      {
        Assert.AreEqual(width, collection[0].Width);
        Assert.AreEqual(height, collection[0].Height);

        using (MagickImage image = collection.AppendHorizontally())
        {
          Assert.AreEqual(width * 3, image.Width);
          Assert.AreEqual(height, image.Height);
        }

        using (MagickImage image = collection.AppendVertically())
        {
          Assert.AreEqual(width, image.Width);
          Assert.AreEqual(height * 3, image.Height);
        }
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:23,代码来源:MagickImageCollectionTests.cs

示例4: Test_Append

    public void Test_Append()
    {
      int width = 70;
      int height = 46;

      using (MagickImageCollection collection = new MagickImageCollection())
      {
        ExceptionAssert.Throws<InvalidOperationException>(delegate ()
        {
          collection.AppendHorizontally();
        });

        ExceptionAssert.Throws<InvalidOperationException>(delegate ()
        {
          collection.AppendVertically();
        });

        collection.Read(Files.RoseSparkleGIF);

        Assert.AreEqual(width, collection[0].Width);
        Assert.AreEqual(height, collection[0].Height);

        using (MagickImage image = collection.AppendHorizontally())
        {
          Assert.AreEqual(width * 3, image.Width);
          Assert.AreEqual(height, image.Height);
        }

        using (MagickImage image = collection.AppendVertically())
        {
          Assert.AreEqual(width, image.Width);
          Assert.AreEqual(height * 3, image.Height);
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:35,代码来源:MagickImageCollectionTests.cs

示例5: Test_Map

    public void Test_Map()
    {
      using (MagickImageCollection colors = new MagickImageCollection())
      {
        colors.Add(new MagickImage(MagickColors.Red, 1, 1));
        colors.Add(new MagickImage(MagickColors.Green, 1, 1));

        using (MagickImage remapImage = colors.AppendHorizontally())
        {
          using (MagickImageCollection collection = new MagickImageCollection())
          {
            ExceptionAssert.Throws<InvalidOperationException>(delegate ()
            {
              collection.Map(null);
            });

            ExceptionAssert.Throws<InvalidOperationException>(delegate ()
            {
              collection.Map(remapImage);
            });

            collection.Read(Files.RoseSparkleGIF);

            ExceptionAssert.Throws<ArgumentNullException>(delegate ()
            {
              collection.Map(null);
            });

            QuantizeSettings settings = new QuantizeSettings();
            settings.DitherMethod = DitherMethod.FloydSteinberg;

            collection.Map(remapImage, settings);

            ColorAssert.AreEqual(MagickColors.Red, collection[0], 60, 17);
            ColorAssert.AreEqual(MagickColors.Green, collection[0], 37, 24);

            ColorAssert.AreEqual(MagickColors.Red, collection[1], 58, 30);
            ColorAssert.AreEqual(MagickColors.Green, collection[1], 36, 26);

            ColorAssert.AreEqual(MagickColors.Red, collection[2], 60, 40);
            ColorAssert.AreEqual(MagickColors.Green, collection[2], 17, 21);
          }
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:45,代码来源:MagickImageCollectionTests.cs

示例6: Test_Evaluate

    public void Test_Evaluate()
    {
      using (MagickImageCollection collection = new MagickImageCollection())
      {
        ExceptionAssert.Throws<InvalidOperationException>(delegate ()
        {
          collection.Evaluate(EvaluateOperator.Exponential);
        });

        collection.Add(new MagickImage(MagickColors.Yellow, 40, 10));

        using (MagickImageCollection frames = new MagickImageCollection())
        {
          frames.Add(new MagickImage(MagickColors.Green, 10, 10));
          frames.Add(new MagickImage(MagickColors.White, 10, 10));
          frames.Add(new MagickImage(MagickColors.Black, 10, 10));
          frames.Add(new MagickImage(MagickColors.Yellow, 10, 10));

          collection.Add(frames.AppendHorizontally());
        }

        using (MagickImage image = collection.Evaluate(EvaluateOperator.Min))
        {
          ColorAssert.AreEqual(MagickColors.Green, image, 0, 0);
          ColorAssert.AreEqual(MagickColors.Yellow, image, 10, 0);
          ColorAssert.AreEqual(MagickColors.Black, image, 20, 0);
          ColorAssert.AreEqual(MagickColors.Yellow, image, 30, 0);
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:30,代码来源:MagickImageCollectionTests.cs

示例7: Test_Deconstruct

    public void Test_Deconstruct()
    {
      using (MagickImageCollection collection = new MagickImageCollection())
      {
        ExceptionAssert.Throws<InvalidOperationException>(delegate ()
        {
          collection.Deconstruct();
        });

        collection.Add(new MagickImage(MagickColors.Red, 20, 20));

        using (MagickImageCollection frames = new MagickImageCollection())
        {
          frames.Add(new MagickImage(MagickColors.Red, 10, 20));
          frames.Add(new MagickImage(MagickColors.Purple, 10, 20));

          collection.Add(frames.AppendHorizontally());
        }

        Assert.AreEqual(20, collection[1].Width);
        Assert.AreEqual(20, collection[1].Height);
        Assert.AreEqual(new MagickGeometry(0, 0, 20, 20), collection[1].Page);
        ColorAssert.AreEqual(MagickColors.Red, collection[1], 3, 3);

        collection.Deconstruct();

        Assert.AreEqual(10, collection[1].Width);
        Assert.AreEqual(20, collection[1].Height);
        Assert.AreEqual(new MagickGeometry(10, 0, 20, 20), collection[1].Page);
        ColorAssert.AreEqual(MagickColors.Purple, collection[1], 3, 3);
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:32,代码来源:MagickImageCollectionTests.cs

示例8: ExecuteAppendHorizontally

 private static MagickImage ExecuteAppendHorizontally(MagickImageCollection collection)
 {
   return collection.AppendHorizontally();
 }
开发者ID:levesque,项目名称:Magick.NET,代码行数:4,代码来源:MagickImageCollection.cs

示例9: Test_SubImageSearch

    public void Test_SubImageSearch()
    {
      using (MagickImageCollection images = new MagickImageCollection())
      {
        images.Add(new MagickImage(Color.Green, 2, 2));
        images.Add(new MagickImage(Color.Red, 2, 2));

        using (MagickImage combined = images.AppendHorizontally())
        {
          using (MagickSearchResult searchResult = combined.SubImageSearch(new MagickImage(Color.Red, 0, 0), ErrorMetric.RootMeanSquared))
          {
            Assert.IsNotNull(searchResult);
            Assert.IsNotNull(searchResult.SimilarityImage);
            Assert.IsNotNull(searchResult.BestMatch);
            Assert.AreEqual(0.0, searchResult.SimilarityMetric);
            Assert.AreEqual(2, searchResult.BestMatch.X);
            Assert.AreEqual(0, searchResult.BestMatch.Y);
          }
        }
      }
    }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:21,代码来源:MagickImageTests.cs

示例10: Test_Normalize

    public void Test_Normalize()
    {
      using (MagickImageCollection images = new MagickImageCollection())
      {
        images.Add(new MagickImage("gradient:gray70-gray30", 100, 100));
        images.Add(new MagickImage("gradient:blue-navy", 50, 100));

        using (MagickImage colorRange = images.AppendHorizontally())
        {
          ColorAssert.AreEqual(new MagickColor("gray70"), colorRange, 0, 0);
          ColorAssert.AreEqual(new MagickColor("blue"), colorRange, 101, 0);

#if Q8
          ColorAssert.AreEqual(new MagickColor("#4e4e4e"), colorRange, 0, 99);
          ColorAssert.AreEqual(new MagickColor("#000081"), colorRange, 101, 99);
#elif Q16 || Q16HDRI
          ColorAssert.AreEqual(new MagickColor("#4e534e534e53"), colorRange, 0, 99);
          ColorAssert.AreEqual(new MagickColor("#0000000081c6"), colorRange, 101, 99);
#else
#error Not implemented!
#endif
          colorRange.Normalize();

          ColorAssert.AreEqual(new MagickColor("white"), colorRange, 0, 0);
          ColorAssert.AreEqual(new MagickColor("blue"), colorRange, 101, 0);

#if Q8
          ColorAssert.AreEqual(new MagickColor("#686868"), colorRange, 0, 99);
          ColorAssert.AreEqual(new MagickColor("#0000b4"), colorRange, 101, 99);
#elif Q16 || Q16HDRI
          ColorAssert.AreEqual(new MagickColor("#67a367a367a3"), colorRange, 0, 99);
          ColorAssert.AreEqual(new MagickColor("#00000000b4f6"), colorRange, 101, 99);
#else
#error Not implemented!
#endif
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:38,代码来源:MagickImageTests.cs

示例11: Test_FlipFlop

    public void Test_FlipFlop()
    {
      using (MagickImageCollection collection = new MagickImageCollection())
      {
        collection.Add(new MagickImage(MagickColors.DodgerBlue, 10, 10));
        collection.Add(new MagickImage(MagickColors.Firebrick, 10, 10));

        using (MagickImage image = collection.AppendVertically())
        {
          ColorAssert.AreEqual(MagickColors.DodgerBlue, image, 5, 0);
          ColorAssert.AreEqual(MagickColors.Firebrick, image, 5, 10);

          image.Flip();

          ColorAssert.AreEqual(MagickColors.Firebrick, image, 5, 0);
          ColorAssert.AreEqual(MagickColors.DodgerBlue, image, 5, 10);
        }

        using (MagickImage image = collection.AppendHorizontally())
        {
          ColorAssert.AreEqual(MagickColors.DodgerBlue, image, 0, 5);
          ColorAssert.AreEqual(MagickColors.Firebrick, image, 10, 5);

          image.Flop();

          ColorAssert.AreEqual(MagickColors.Firebrick, image, 0, 5);
          ColorAssert.AreEqual(MagickColors.DodgerBlue, image, 10, 5);
        }
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:30,代码来源:MagickImageTests.cs


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