A similar question has already been asked on this thread:
Save JPG in progressive format
However, the answer marked is basically saying that it can't be done. However, considering it is done using other software, it definitely is something which C# can do.
Is there any way this can be done?
With baseline JPEG, your users see a large white space on the screen or a loading circle spinning until the image has finished loading. With progressive JPEG, visitors can already see the entire image at first sight. Although it's blurry, they can still understand what's in the image.
Opening the progressive JPG in any image editing program and then saving it as JPG should convert the file. So if you use Image Events in Applescript (which is just a front end to sips) to open the file and then save it choosing JPG as the format that should convert it.
A progressive JPEG image is encoded differently than a standard or baseline JPEG image. It loads in successive waves until a clear picture is formed. This can improve a website's performance as the images seems to be loading faster.
Magick.NET can do it with a code 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");
}
You can find more details here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With