This project has moved. For the latest updates, please go here.

didn't find how to set progressive jpeg or interleace

Jul 22, 2013 at 1:30 PM
Edited Jul 22, 2013 at 1:42 PM
Congratulations!
this .NET project is a wonderful job. It make image handling with magick a lot easier in NET environments.
I will appreciate if someone could help to find the right way to save the magickImage object as progressive jpeg (and optionally specify the jpeg sampling method)

(my magickImage object was created with "new MagickImage(color, width,height)" and has been modified with writablePixels, now just need to save it as progressive jpeg with specific quality and optionally different subsampling.)

Try several methods, attributes,, formats, options, properties without success.
Hope you can help.
Thank you in advance.

dll version: Magick.NET-6.8.6.301-Q8-x86-net40-client
Coordinator
Jul 22, 2013 at 4:56 PM
You can write an progressive image like this:
using (MagickImage image = new MagickImage("input.png"))
{
  // Set the format and write to a stream so ImageMagick won't detect the file type.
  image.Format = MagickFormat.Pjpeg;
  using (FileStream fs = new FileStream("output.jpg", FileMode.Create))
  {
    image.Write(fs);
  }
  // Write to .jpg file
  image.Write("PJEG:output.jpg");
  // Or to a .pjpeg file
  image.Write("output.pjpg");
}
At this moment you are unable to set the the jpeg specific options. I will create a workitem to resolve this. Do you want to change the jpeg sampling factor (http://www.imagemagick.org/script/command-line-options.php#sampling-factor) or something else?
Coordinator
Jul 22, 2013 at 4:57 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 22, 2013 at 5:32 PM
it works !! (just save the file with pjpg extension)
Your perfect and quick answer probe that you are working on this project seriously.

Thank you very much.

Regarding the subsampling option, you are pointing to the right direction. (sampling-factor)

I was using image and pixel manipulation with the native .net tools for years with success.
The fundamental reason to start using imageMagic and your excellent .Net wrapper is the progressive and subsampling definitions (you can read, but you can't save an image with standard .NET framework with the progressive jpeg feature)

Thank you one more time for all your help. You are doing an excellent job.

I will follow the discussion of the sampling-factor.
Coordinator
Jul 22, 2013 at 7:44 PM
With the next release (will be published in a couple of weeks) you will be able to do this:
image.SetOption(MagickFormat.Jpeg, "sampling-factor", "4x1,2x1,2x1");
Jul 22, 2013 at 8:21 PM
It will be wonderful. ImageMagick.net developers will appreciate that.
Thank you.
Happy to include credits in the final product.