Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better readme explaining MozJPEG's features #241

Closed
kornelski opened this issue Mar 16, 2017 · 1 comment
Closed

Better readme explaining MozJPEG's features #241

kornelski opened this issue Mar 16, 2017 · 1 comment

Comments

@kornelski
Copy link
Member

The current readme is very terse and doesn't say much about MozJPEG's features and benefits.

I suggest expanding it with more in-depth description, list of features, example images and links to related articles.

@DeeDeeG
Copy link

DeeDeeG commented Apr 24, 2017

(trying my hand at a general introduction to mozjpeg. This can be refined later or not used, but I'd also like to see a high quality reference for this software, and so I'd like to get the ball rolling.)

To start with, a rundown of all the command-line options (and how they are desirable in common real-world usage scenarios) would be great. I am learning this as I go. My findings for running with no flags: ...

Running it with no flags seems to:

  • Make a "progressive" jpg (as opposed to "baseline")

  • Run only lossless compression

This makes running without flags useful as a last-step after all other compression steps have been done, regardless of what tool they were done with.

e.g. following up after exporting in a lossy way with GIMP, following up after using Guetzli, etc. etc.

Adding the -fastcrunch flag will make a baseline jpg instead of progressive jpg.

(Why use baseline vs progressive?: Baseline jpgs anecdotally have been said to be faster/simpler to decode, and said to have have wider support than progressive. Also, baseline jpgs anecdotally have been said to fully render in a browser faster than progressive (according to comments in the Guetzli GitHub issues). On the plus side, progressive jpgs display faster (as a blurry image) even before fully downloaded, if the client supports this, and can usually compress to a smaller size than baseline jpgs. I don't know if every detail I listed here is really true, or if these are all relevant concerns for real world use, just listing some differences I have heard of.)

A section about using quality settings properly would be helpful.

A setting of 95 results in very high quality image, roughly the maximum the lossy encoding operation can produce. Higher than 95 will usually not produce visibly better images, but the file size will be significantly larger.

Lower quality settings can save a significant amount in the file size, whereas artifacts or degradations may in some cases not be noticeable, even down to a quality of 50. There is no quality number that will guarantee an artifact-free image smaller than your input; likewise there is no quality number that will guarantee the best filesize savings and still retain acceptable quality across all images. Around 80 or 85 is usually a safe choice for good savings without extreme artifacts, but your mileage may vary, and selecting a tailored quality setting per-image is encouraged for truly optimal results.

(Note: I downloaded a mozjpeg.exe Windows binary from here, so I don't run jpegtran, or cjpeg, or anything else... just "mozjpeg.exe [flags] [input file]")

(Note 2: these are more recent, cool site also: https://mozjpeg.codelove.de/binaries.html)

(note number 3: This is the closest thing to a high-quality reference for mozjpeg I have found so far on the web, after a quick search for same (focuses on using cjpeg): https://hacks.mozilla.org/2014/08/using-mozjpeg-to-create-efficient-jpegs/)

(Note number 4: Wikipedia goes over jpegtran here: https://en.wikipedia.org/wiki/Libjpeg#jpegtran)

pull bot pushed a commit to admariner/mozjpeg that referenced this issue Aug 15, 2022
People keep trying to include libjpeg-turbo into downstream CMake-based
build systems by way of the add_subdirectory() function and requesting
upstream support when something inevitably breaks.

(Refer to: mozilla#122, mozilla#173, mozilla#176, mozilla#202, mozilla#241, mozilla#349, mozilla#353, mozilla#412, #504,
libjpeg-turbo/libjpeg-turbo@a3d4aad#commitcomment-67575889).

libjpeg-turbo has never supported that method of sub-project
integration, because doing so would require that we (minimally):

1. avoid using certain CMake variables, such as CMAKE_SOURCE_DIR,
   CMAKE_BINARY_DIR, and CMAKE_PROJECT_NAME;
2. avoid using implicit include directories and relative paths;
3. provide a way to optionally skip the installation of libjpeg-turbo
   components in response to 'make install';
4. provide a way to optionally postfix target names, to avoid namespace
   conflicts;
5. restructure the top-level CMakeLists.txt so that it properly sets
   the PROJECT_VERSION variable; and
6. design automated CI tests to ensure that new commits don't break
   any of the above.

Even if we did all of that, issues would still arise, because it is
impossible for one upstream build system to anticipate the widely
varying needs of every downstream build system.  That's why the CMake
ExternalProject_Add() function exists, and it is my sincere hope that
adding a blurb to BUILDING.md mentioning the need to use that function
will head off future GitHub issues on this topic.  If not, then I can at
least post a link to this commit and the blurb and avoid doing the same
song and dance over and over again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants