I hear that mozjpeg
is a nice jpeg compressor from Mozilla. How can I convert my folder with *.tiff to jpg from terminal using mozjpeg?
-
TIFF is a container. Chances are that your images are already in JPEG format, just wrapped inside TIFF.– Andrea CorbelliniAug 18, 2015 at 12:02
2 Answers
You will have to build mozjpeg
from source.
If you do have the packages to compile it, you can install it with the following command:
sudo apt-get install autoconf automake libtool nasm make pkg-config git
Fetch the source code with:
git clone https://github.com/mozilla/mozjpeg.git
Build it with:
cd mozjpeg autoreconf -fiv ./configure --prefix=/usr make
You will have 2 options: to install with the command:
make install
or to create a "deb" (that you then can use to install) with:
make deb
But it does not seem to support "tiff". So you need to extract the files 1st. See How to convert TIFF scan file to JPEG or PNG general file format in Ubuntu? for that.
This is a generic command to compress a jpg to 75%:
convert filename1.jpg pnm:- | cjpeg -quality 75 > filename2.jpg
The jpegtran
tool can be used to optimise an image:
jpegtran -outfile filename1.jpg -optimise -copy none filename2.jpg
If you get any errors please edit your question and I'll have a look.
I have checked all man-pages
/usr/share/man/man1/djpeg.1
/usr/share/man/man1/cjpeg.1
/usr/share/man/man1/jpegtran.1
/usr/share/man/man1/wrjpgcom.1
/usr/share/man/man1/rdjpgcom.1
but I think I have to disappoint you. You can't convert images from TIFF to JPEG with any of these programs.
After the installation with the steps described in Rinzwind answer I have installed the deb. The following files are installed:
Output of dpkg -L mozjpeg
/.
/usr
/usr/bin
/usr/bin/cjpeg
/usr/bin/djpeg
/usr/bin/rdjpgcom
/usr/bin/tjbench
/usr/bin/wrjpgcom
/usr/bin/jpegtran
/usr/lib
/usr/lib/libjpeg.so.62.2.0
/usr/lib/libturbojpeg.a
/usr/lib/libturbojpeg.so.0.1.0
/usr/lib/libjpeg.a
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/djpeg.1
/usr/share/man/man1/cjpeg.1
/usr/share/man/man1/jpegtran.1
/usr/share/man/man1/wrjpgcom.1
/usr/share/man/man1/rdjpgcom.1
/usr/share/doc
/usr/share/doc/mozjpeg-3.1
/usr/share/doc/mozjpeg-3.1/wizard.txt
/usr/share/doc/mozjpeg-3.1/usage.txt
/usr/share/doc/mozjpeg-3.1/libjpeg.txt
/usr/share/doc/mozjpeg-3.1/structure.txt
/usr/share/doc/mozjpeg-3.1/README
/usr/share/doc/mozjpeg-3.1/README-turbo.txt
/usr/share/doc/mozjpeg-3.1/README-mozilla.txt
/usr/share/doc/mozjpeg-3.1/example.c
/usr/include
/usr/include/jconfig.h
/usr/include/turbojpeg.h
/usr/include/jmorecfg.h
/usr/include/jerror.h
/usr/include/jpeglib.h
/usr/lib/libjpeg.so
/usr/lib/libturbojpeg.so
/usr/lib/libjpeg.so.62
/usr/lib/libturbojpeg.so.0
-
1What is this long list? Maybe you can say, how can I build from source (or install deb) of mozjpeg? This project did not have any documentation... Aug 18, 2015 at 12:26
-
1I undeleted my answer (it was about how to compile it) BUT it looks like you can NOT use it for tiff.– RinzwindAug 18, 2015 at 12:51
-