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


C# MagickImage.GetDefine方法代码示例

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


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

示例1: Test_PreserveiCCP_SwapBytes

    public void Test_PreserveiCCP_SwapBytes()
    {
      PngReadDefines defines = new PngReadDefines()
      {
        PreserveiCCP = true,
        SwapBytes = false
      };

      using (MagickImage image = new MagickImage())
      {
        image.SetDefines(defines);

        Assert.AreEqual("True", image.GetDefine(MagickFormat.Png, "preserve-iCCP"));
        Assert.AreEqual(null, image.GetDefine(MagickFormat.Png, "swap-bytes"));
      }

      defines = new PngReadDefines()
      {
        PreserveiCCP = false,
        SwapBytes = true
      };

      using (MagickImage image = new MagickImage())
      {
        image.SetDefines(defines);

        Assert.AreEqual(null, image.GetDefine(MagickFormat.Png, "preserve-iCCP"));
        Assert.AreEqual("True", image.GetDefine(MagickFormat.Png, "swap-bytes"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:30,代码来源:PngReadDefinesTests.cs

示例2: Test_DctMethod_OptimizeCoding_Quality_QuantizationTables_SamplingFactors

    public void Test_DctMethod_OptimizeCoding_Quality_QuantizationTables_SamplingFactors()
    {
      JpegWriteDefines defines = new JpegWriteDefines()
      {
        DctMethod = DctMethod.Fast,
        OptimizeCoding = false,
        Quality = new MagickGeometry(80, 80),
        QuantizationTables = @"C:\path\to\file.xml",
        SamplingFactors = new MagickGeometry[]
        {
          new MagickGeometry(5, 10),
          new MagickGeometry(15, 20)
        }
      };

      using (MagickImage image = new MagickImage(Files.Builtin.Logo))
      {
        image.SetDefines(defines);

        Assert.AreEqual("Fast", image.GetDefine(MagickFormat.Jpeg, "dct-method"));
        Assert.AreEqual("False", image.GetDefine(MagickFormat.Jpeg, "optimize-coding"));
        Assert.AreEqual("80x80", image.GetDefine(MagickFormat.Jpeg, "quality"));
        Assert.AreEqual(@"C:\path\to\file.xml", image.GetDefine(MagickFormat.Jpeg, "q-table"));
        Assert.AreEqual("5x10,15x20", image.GetDefine(MagickFormat.Jpeg, "sampling-factor"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:26,代码来源:JpegWriteDefinesTests.cs

示例3: Test_UseCropBox_UseTrimBox

    public void Test_UseCropBox_UseTrimBox()
    {
      PdfReadDefines defines = new PdfReadDefines()
      {
        UseCropBox = true,
        UseTrimBox = false
      };

      using (MagickImage image = new MagickImage())
      {
        image.SetDefines(defines);

        Assert.AreEqual("True", image.GetDefine(MagickFormat.Pdf, "use-cropbox"));
        Assert.AreEqual("False", image.GetDefine(MagickFormat.Pdf, "use-trimbox"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:16,代码来源:PdfReadDefinesTests.cs

示例4: Test_ClusterFit_Mipmaps_WeightByAlpha

    public void Test_ClusterFit_Mipmaps_WeightByAlpha()
    {
      DdsWriteDefines defines = new DdsWriteDefines()
      {
        ClusterFit = true,
        Mipmaps = 0,
        WeightByAlpha = false,
      };

      using (MagickImage image = new MagickImage(Files.Builtin.Logo))
      {
        image.SetDefines(defines);

        Assert.AreEqual("True", image.GetDefine(MagickFormat.Dds, "cluster-fit"));
        Assert.AreEqual("0", image.GetDefine(MagickFormat.Dds, "mipmaps"));
        Assert.AreEqual("False", image.GetDefine(MagickFormat.Dds, "weight-by-alpha"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:18,代码来源:DdsWriteDefinesTests.cs

示例5: Test_FillOrder_RowsPerStrip

    public void Test_FillOrder_RowsPerStrip()
    {
      TiffWriteDefines defines = new TiffWriteDefines()
      {
        FillOrder = Endian.LSB,
        RowsPerStrip = 42,
        TileGeometry = new MagickGeometry(100, 100)
      };

      using (MagickImage image = new MagickImage(Files.Builtin.Logo))
      {
        image.SetDefines(defines);

        Assert.AreEqual("LSB", image.GetDefine(MagickFormat.Tiff, "fill-order"));
        Assert.AreEqual("42", image.GetDefine(MagickFormat.Tiff, "rows-per-strip"));
        Assert.AreEqual("100x100", image.GetDefine(MagickFormat.Tiff, "tile-geometry"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:18,代码来源:TiffWriteDefinesTests.cs

示例6: Test_BlockSmoothing_DctMethod_FancyUpsampling

    public void Test_BlockSmoothing_DctMethod_FancyUpsampling()
    {
      MagickReadSettings settings = new MagickReadSettings()
      {
        Defines = new JpegReadDefines()
        {
          BlockSmoothing = true,
          DctMethod = DctMethod.Slow,
          FancyUpsampling = false
        }
      };

      using (MagickImage image = new MagickImage())
      {
        image.Read(Files.ImageMagickJPG, settings);

        Assert.AreEqual("True", image.GetDefine(MagickFormat.Jpeg, "block-smoothing"));
        Assert.AreEqual("Slow", image.GetDefine(MagickFormat.Jpeg, "dct-method"));
        Assert.AreEqual("False", image.GetDefine(MagickFormat.Jpeg, "fancy-upsampling"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:21,代码来源:JpegReadDefinesTests.cs

示例7: Test_SkipProfiles

    public void Test_SkipProfiles()
    {
      MagickReadSettings settings = new MagickReadSettings()
      {
        Defines = new PngReadDefines()
        {
          SkipProfiles = ProfileTypes.Xmp | ProfileTypes.Exif
        }
      };

      using (MagickImage image = new MagickImage())
      {
        image.Read(Files.FujiFilmFinePixS1ProPNG);
        Assert.IsNotNull(image.GetExifProfile());
        Assert.IsNotNull(image.GetXmpProfile());

        image.Read(Files.FujiFilmFinePixS1ProPNG, settings);
        Assert.IsNull(image.GetExifProfile());
        Assert.IsNull(image.GetXmpProfile());
        Assert.AreEqual("Exif,Xmp", image.GetDefine(MagickFormat.Unknown, "profile:skip"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:22,代码来源:PngReadDefinesTests.cs

示例8: Test_Define

    public void Test_Define()
    {
      using (MagickImage image = new MagickImage(Files.Builtin.Logo))
      {
        string option = "optimize-coding";

        image.SetDefine(MagickFormat.Jpg, option, true);
        Assert.AreEqual("true", image.GetDefine(MagickFormat.Jpg, option));
        Assert.AreEqual("true", image.GetDefine(MagickFormat.Jpeg, option));

        image.RemoveDefine(MagickFormat.Jpeg, option);
        Assert.AreEqual(null, image.GetDefine(MagickFormat.Jpg, option));

        image.SetDefine(MagickFormat.Jpeg, option, "test");
        Assert.AreEqual("test", image.GetDefine(MagickFormat.Jpg, option));
        Assert.AreEqual("test", image.GetDefine(MagickFormat.Jpeg, option));

        image.RemoveDefine(MagickFormat.Jpg, option);
        Assert.AreEqual(null, image.GetDefine(MagickFormat.Jpeg, option));

        image.SetDefine(MagickFormat.Unknown, "profile:skip", "ICC");
        Assert.AreEqual("ICC", image.GetDefine(MagickFormat.Unknown, "profile:skip"));
      }
    }
开发者ID:marinehero,项目名称:Magick.NET,代码行数:24,代码来源:MagickImageTests.cs

示例9: Test_SkipProfiles

    public void Test_SkipProfiles()
    {
      MagickReadSettings settings = new MagickReadSettings()
      {
        Defines = new JpegReadDefines()
        {
          SkipProfiles = ProfileTypes.Iptc | ProfileTypes.Icc
        }
      };

      using (MagickImage image = new MagickImage())
      {
        image.Read(Files.FujiFilmFinePixS1ProJPG);
        Assert.IsNotNull(image.GetIptcProfile());

        image.Read(Files.FujiFilmFinePixS1ProJPG, settings);
        Assert.IsNull(image.GetIptcProfile());
        Assert.AreEqual("Icc,Iptc", image.GetDefine(MagickFormat.Unknown, "profile:skip"));
      }
    }
开发者ID:levesque,项目名称:Magick.NET,代码行数:20,代码来源:JpegReadDefinesTests.cs


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