README 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. mozjpeg (Mozilla JPEG Encoder Project)
  2. mozjpeg is a fork of libjpeg-turbo from Mozilla Research. Its
  3. goal is to reduce the size of JPEG files without reducing quality
  4. or compatibility with the vast majority of the world's deployed
  5. decoders. The idea is to reduce transfer times for JPEGs on the Web,
  6. thus reducing page load times.
  7. mozjpeg is not intended to be a general JPEG library replacement. It
  8. makes tradeoffs that are intended to benefit Web use cases and
  9. focuses solely on improving encoding. It is best used as part of a Web
  10. encoding workflow.
  11. In essence, libjpeg-turbo (as shipped with Slackware) is optimized
  12. for speed of encoding/decoding, while mozjpeg is optimized for
  13. encoding smaller file sizes (at the expense of speed). mozjpeg will
  14. not interfere with Slackware's libjpeg-turbo package, as it installs
  15. to /opt/mozjpeg/.
  16. mozjpeg supports multiple versions of the libjpeg API. By default,
  17. version 6b is built. If you need compatibility with libjpeg 7 or 8,
  18. set API=7 or API=8 in the script's environment.
  19. Usage
  20. -----
  21. To run the binaries, either call them by their full paths, e.g:
  22. $ /opt/mozjpeg/bin/cjpeg
  23. ...or else:
  24. $ source /etc/profile.d/mozjpeg.sh
  25. ...to temporarily make mozjpeg the default, in the current shell.
  26. Running e.g. "cjpeg" will now run the mozjpeg one. If you wanted to
  27. do this permanently for all users (not recommended), you could:
  28. # chmod +x /etc/profile.d/mozjpeg.sh
  29. ...then log out and back in. The profile script isn't executable by
  30. default, to avoid surprises.
  31. Development
  32. -----------
  33. To compile & link with the mozjpeg libraries, use -I/opt/mozjpeg/include
  34. and -L/opt/mozjpeg/lib (or lib64). You might also want -static, or
  35. else -Wl,-rpath,/opt/mozjpeg/lib (or lib64). Starting with version 3.2,
  36. there's also pkg-config support for mozjpeg. If you source the profile
  37. script, software that uses pkg-config should find and link with the
  38. mozjpeg libraries automatically.
  39. Java Support
  40. ------------
  41. Optionally, mozjpeg can be built with Java wrapper support
  42. for turbojpeg. To do this, install one of: jdk, openjdk8,
  43. openjdk7, or openjdk6 (or possibly one of the zulu-openjdk*
  44. packages; untested). Then run this script with JAVA=yes in
  45. the environment. The Java library will be installed as
  46. /opt/mozjpeg/classes/turbojpeg.jar, and the docs will be in
  47. /usr/doc/mozjpeg-$VERSION/javadoc.