tjko / jpegoptim

jpegoptim - utility to optimize/compress JPEG files
http://www.iki.fi/tjko/projects.html
GNU General Public License v3.0
1.56k stars 116 forks source link

Progressive JPEG files by default? #142

Closed wwinniww closed 9 months ago

wwinniww commented 1 year ago

I use the windows 64 bit compile of jpegoptim 1.5.3

I noticed that every optimized jpeg file is progressive, but I don't specify --all-progressive as command line parameter. Shouldn't be the default operation unless specified otherwise to keep sequential JPEG instead of converting every JPEG file into progressive JPEG?

tjko commented 1 year ago

I couldn't replicate this. Are you perhaps using mozjpeg, and not libjpeg? (I was testing with jpegoptim compiled against latest libjpeg).

wwinniww commented 1 year ago

Thanks for you reply. I use the pre-compiled program you provide here. I didn't compile jpegoptim for myself. I did not install MozJpeg anywhere on my PC, at least not intentionally.

I just use the pre-compiled jpegoptim program 1.5.3 x64 for Windows, which I downloaded from this website. Nothing else.

So my conclusion is that the pre-compliled version of Jpegoptim converts normal Jpeg files to progressive Jpeg files.

tjko commented 1 year ago

Looks like it must be mozjpeg library doing this. It seems to default to progressive (presumably because that typically produces slightly smaller files than non-progressive mode), so its not 100% compatible with libjpeg....

Have to see if there is way to make it behave like libjpeg in this regard.

wwinniww commented 1 year ago

Thanks. Nice to have feature might be to display both normal and progressive jpeg file sizes when --no-action parameter is specified.

tjko commented 1 year ago

I think this should now be fixed. If you want to test the fix, you can find binaries here: https://github.com/tjko/jpegoptim/actions/runs/4559486709

wwinniww commented 1 year ago

Thanks. I did test the windows test compile you provided. I can't that the compile for Apple Mac, and I don't have access to a PC with Linux OS atm.

The behaviour for normal Jpeg files is correct now, for progressive jpeg files there is a little side effect, in default mode the optization is less effective compared to when progressive mode is specified. My verdict is default mode use libjpeg, whereas in progressive mode mozjpeg is used for optimization.

So for best optimization of progressive jpeg files the switch --all-progressive is needed according to my tests.

tjko commented 1 year ago

Maybe better (less intrusive) is to implement new option like --preserve-mode that could be used if someone wants to prevent JPEG changing from normal to progressive during optimization. Since most users likely just want smallest possible file (by default) and progressive vs non-progressive JPEG is not a factor at all... (?)

wwinniww commented 1 year ago

Hello. The only drawback when it comes to this is: Progressive JPEG images takes noticeably longer to decode compared to normal JPEG. I don't know if every JPEG decoder out there is able to decode progressive JPEG.

I think that a --preserve-mode switch is a good idea.

An other minor thing, maybe the help option of the program should not display unavailable option, in the case jpegoptim is compiled without support of arithmetic coding, why should help show that option?

Thanks.

starleafs commented 1 year ago

I noticed that progressive jpegs not showing correctly on mac/ios jpegoptim version 1.5.3 windows

When I covert images using standard method (jpegoptim.exe --max=90), I received images display wired colour lines opening with mac/ios, but images display correctly on PC. After reading this post, i use non-progressive method (jpegoptim.exe --max=90 --all-normal), I received images display correctly both on PC/Mac

is it a bug? I've attched screenshot and sample images below IMG_0841-progressive(screenshot from mac) IMG_0841-progressive(screenshot from PC)

tjko commented 9 months ago

I noticed that progressive jpegs not showing correctly on mac/ios jpegoptim version 1.5.3 windows

When I covert images using standard method (jpegoptim.exe --max=90), I received images display wired colour lines opening with mac/ios, but images display correctly on PC. After reading this post, i use non-progressive method (jpegoptim.exe --max=90 --all-normal), I received images display correctly both on PC/Mac

is it a bug? I've attched screenshot and sample images below

@starleafs, can you provide the actual image file(s)? So I could test, if I can reproduce the issue you're seeing.

wwinniww commented 9 months ago

Hello, sorry Timo. I can’t check that. I don’t own devices from Apple or have Access to them Right now.

Gesendet von Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 für Windows


Von: Timo Kokkonen @.> Gesendet: Monday, October 30, 2023 5:18:18 AM An: tjko/jpegoptim @.> Cc: wwinniww @.>; Author @.> Betreff: Re: [tjko/jpegoptim] Progressive JPEG files by default? (Issue #142)

I noticed that progressive jpegs not showing correctly on mac/ios jpegoptim version 1.5.3 windows

When I covert images using standard method (jpegoptim.exe --max=90), I received images display wired colour lines opening with mac/ios, but images display correctly on PC. After reading this post, i use non-progressive method (jpegoptim.exe --max=90 --all-normal), I received images display correctly both on PC/Mac

is it a bug? I've attched screenshot and sample images below

@starleafshttps://github.com/starleafs, can you provide the actual image file(s)? So I could test, if I can reproduce the issue you're seeing.

― Reply to this email directly, view it on GitHubhttps://github.com/tjko/jpegoptim/issues/142#issuecomment-1784453326, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6Z4OIT7HNGZRS6WMA5WXQ3YB4TAVAVCNFSM6AAAAAAWLAXU32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGQ2TGMZSGY. You are receiving this because you authored the thread.Message ID: @.***>

starleafs commented 9 months ago

I noticed that progressive jpegs not showing correctly on mac/ios jpegoptim version 1.5.3 windows When I covert images using standard method (jpegoptim.exe --max=90), I received images display wired colour lines opening with mac/ios, but images display correctly on PC. After reading this post, i use non-progressive method (jpegoptim.exe --max=90 --all-normal), I received images display correctly both on PC/Mac is it a bug? I've attched screenshot and sample images below

@starleafs, can you provide the actual image file(s)? So I could test, if I can reproduce the issue you're seeing.

Hello, I tested again with jpegoptim version 1.5.5 and I think this bug was fixed on version v1.5.4 (Fix mozjpeg not preserving JPEG mode (progressive vs normal) by @tjko in #143

thanks.