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

JPEG Progressive Format Option

Nov 11, 2015 at 12:25 PM
Could you please help me with one simple thing understanding ?

Can I detect JPEG image Format Option using Magick.NET? I mean, am I able to figure out if a JPEG image is saved with Format Option - "Progressive" and to reset this Format Option into "Baseline (Standard)".
Please refer to the following screenshot for clarification
Nov 11, 2015 at 12:30 PM
Edited Nov 11, 2015 at 12:31 PM
If you want to check if a JPEG image is progressive you should check if the Interlace property of the MagickImage is set to Jpeg. And if you want to change it to baseline you should set the Interlace property to NoInterlace. Be aware that JPEG is lossy so you should only want to write the image if the Interlace property is Jpeg. In the next version of Magick.NET ( you will be able to use the MagickImageInfo class to quickly check the Interlace value of an image. This will help you if you need to process a lot of images.

p.s. Thanks for posting the message here also :)
Nov 11, 2015 at 12:42 PM
Thank you very much for quick answer!

Are you sure this feature works as expected?
I'm setting Interlace property to NoInterlace, saving my Image and everything is fine. When I open this image again, I see the Interlace property becomes NoInterlace, but when I open this image in Photoshop I see that Format Option didn't change.
What's the magic here?

I attached my method below.
public static void ChangeJpegFormatOption(string sourcePath)
            using (var magickImage = new MagickImage(sourcePath))
                if (magickImage.Interlace == Interlace.Jpeg)
                    magickImage.Interlace = Interlace.NoInterlace;
                    SaveImage(sourcePath, magickImage);
Nov 11, 2015 at 1:40 PM
Is it possible that Photoshop is not showing you the current value of the image?
Nov 11, 2015 at 2:01 PM
Edited Nov 11, 2015 at 3:19 PM
Yes, I thought about this, but when I'm trying to resave in Photoshop an image with "Baseline (Standard)" Format Option - I see the that appropriate radio button is selected.

Also could you please tell which Interlace property value will be if my JPEG is saved with "Baseline Optimized" Format Option?

UPD: Interlace property value for JPEG with "Baseline Optimized" Format Option is also Interlace.NoInterlace.

Is there any way to differentiate images with "Baseline (Standard)" and "Baseline Optimized" Format Options?
Nov 11, 2015 at 3:40 PM
Edited Nov 11, 2015 at 3:44 PM
I don't think you can get the difference between Baseline (Standard)" and "Baseline Optimized" with Magick.NET. Maybe it does lossless compression? You can do that with Magick.NET with the following code:
var optimizer = new ImageMagick.ImageOptimizers.JpegOptimizer();
optimizer.Progressive = false;
  If you set this to false only 'optimizer.Progressive' will be
  checked and the inverse won't be done
optimizer.OptimalCompression = false;
The downside of this is that it will only work if it produces a smaller file. Maybe I should add an extra method to the optimizer that will 'optimize' the file even if the result is larger. Not sure what I should call that method though.
Nov 11, 2015 at 4:20 PM
The main reason why I need to figure out image Format Option is that some API integrated into my system works only with JPEG in "Baseline (Standard)" format. That's why I really need to check this option and convert images which are not "Baseline (Standard)".

I'm sorry to hear there's no possibility to differentiate images with "Baseline (Standard)" and "Baseline Optimized" options.
I will try to figure out this somehow else.
Nov 12, 2015 at 9:48 AM
I found the following post that describes the difference: I really wonder if there is software (besides Photoshop) to detect the difference.
Baseline Standard is used when you want your JPG to be recognizable to most web browsers. It's basic and, well.... standard! It makes the least amount of changes to your image. All web browsers support it.

Baseline Optimized optimizes the color quality of the image and produces a slightly smaller file size (2 to 8% - a little more compression, or slightly faster loading). All modern web browsers support it, but not some of the earliest versions of web browsers.

Both Standard and Optimized produce good quality images, so it's really just a matter of choice... or habit. And I guess my choice is Optimized.

Baseline Progressive creates and image that will display gradually as it's downloaded... remember the old days of painfully slow browsers when photos loaded on a page in a series of lines instead of all at once? We'd never use that one anymore.