Jpegoptim: for Windows

Created on 26 Oct 2014  ·  11Comments  ·  Source: tjko/jpegoptim

Most helpful comment

All 11 comments

-1

Seems to be abandoned. The latest build is still v1.3.0. http://sourceforge.net/projects/jpegoptim/files/jpegoptim/

So there's no uptodate win32 port?
Where is the howto for mingw32 or cygwin build?

I cannot find them anywhere, and I want them too.

The exe on SourceForge has the string msvcrt.dll in it.

I am willing to build jpegoptim for windows - I have a MinGW32 environment setup.
Currently When I try to ./configure with bash for windows I get the following:

checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking for jpeg_read_header in -ljpeg... no
Cannot find libjpeg or you have too old version (v6 or later required).

Does anyone know how to get past that?

Maybe you should install an updated version of libjpeg.
v9 is the latest.
I suggest you to use mozjpeg which is much better.

@szepeviktor Installing libjpeg doesn't help. I have a prebuilt version of mozjpeg though, now I just need a wrapper like jpegoptim that takes care of the file manipulation (mozjpeg doesn't allow you to overwrite the original file). Perhaps I could write one myself.

@szepeviktor That tool looks rather good actually. I think I might switch to using that instead! It looks like it achieves a much higher level of compression (even if it is a bit lossy). The result looks almost identical to the original, which is the main thing.

Thanks for all your help :)

It's not hard to cross-compile a Windows binary in Cygwin. I prefer that because it's a more Unix-like environment so less things break during the build process.

First get mozjpeg. It will be slower but give better progressive compression rates than libjpeg. I got mozjpeg-3.1-release-source.tar.gz from the releases page. There's a lot of work going on there, and I don't want to risk some insufficiently tested work in progress messing up my images. If using mozjpeg, use a jpegoptim version after f3701c9 because otherwise all images will probably be progressive. It will still default to progressive, so you need the --all-normal switch if you don't want that.

I'm using the i686-w64-mingw32 compiler in Cygwin. Mozjpeg is easy to build via ./configure --host=i686-w64-mingw32 followed by make. It eventually failed because I didn't have libpng, but I don't care because it already built the libraries. I didn't want to install mozjpeg, so I configured jpegoptim while providing paths to mozjpeg: CPPFLAGS=-I../mozjpeg LDFLAGS=-L../mozjpeg/.libs ./configure --host=i686-w64-mingw32. Finally, I re-built jpegoptim with an edited command, replacing -ljpeg with the static mozjpeg library so it doesn't depend on the mozjpeg DLL: i686-w64-mingw32-gcc -g -O2 -I../mozjpeg -DHAVE_CONFIG_H -o jpegoptim jpegoptim.o jpegdest.o misc.o -L../mozjpeg/.libs -lm ../mozjpeg/.libs/libjpeg.a

Finally here is the win32 binary.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

talha-asad picture talha-asad  ·  3Comments

djromero picture djromero  ·  8Comments

jmcnevin picture jmcnevin  ·  5Comments

lmcd picture lmcd  ·  17Comments

kr picture kr  ·  16Comments