1

I am using Magick.NET For Image Manipulation in C#. Is it possible to Control Chroma Subsampling and/or specify alternate Quantization Tables While saving as JPEG using Magick.NET.

vinu
  • 125
  • 4

1 Answers1

1

You can set sampling factors and the quantization tables with the JpegWriteDefines class. Below is an example on how you can do that.

using (MagickImage image = new MagickImage("wizard:"))
{
  image.Write(@"c:\test.jpg", new JpegWriteDefines()
  {
    SamplingFactors = new MagickGeometry[]
    {
      new MagickGeometry ("2x2"),
      new MagickGeometry ("1x1"),
      new MagickGeometry ("1x1")
    },
    QuantizationTables = @"c:\YourQuantizationTables.xml"
  });
}

An example file for the quantization tables can be found here: https://github.com/ImageMagick/ImageMagick/blob/master/config/quantization-table.xml

dlemstra
  • 7,813
  • 2
  • 27
  • 43