Files
squoosh/codecs/mozjpeg_enc
Ingvar Stepanyan d3252bb1bb Add LTO for C++ builds (#755)
* Add LTO for C++ builds

This didn't have much effect on fastcomp builds, but provides further size savings with new LLVM backend we switched to in #750 (and fixes the MozJPEG size regression from the same PR).

In the future we won't need to pass `--llvm-lto 1` explicitly, but latest Emscripten Docker image doesn't contain the Emscripten version with the necessary fixes for this.

* Delete build.log

Co-authored-by: Jake Archibald <jaffathecake@gmail.com>
2020-05-05 11:54:28 +01:00
..
2020-05-05 11:54:28 +01:00
2020-05-05 11:54:28 +01:00
2020-05-05 11:54:28 +01:00
2020-05-01 15:00:10 +01:00

MozJPEG encoder

Dependencies

  • Docker

Example

See example.html

API

int version()

Returns the version of MozJPEG as a number. va.b.c is encoded as 0x0a0b0c

void free_result()

Frees the result created by encode().

Uint8Array encode(std::string image_in, int image_width, int image_height, MozJpegOptions opts)

Encodes the given image with given dimension to JPEG. Options looks like this:

struct MozJpegOptions {
  int quality;
  bool baseline;
  bool arithmetic;
  bool progressive;
  bool optimize_coding;
  int smoothing;
  int color_space;
  int quant_table;
  bool trellis_multipass;
  bool trellis_opt_zero;
  bool trellis_opt_table;
  int trellis_loops;
  bool auto_subsample;
  int chroma_subsample;
  bool separate_chroma_quality;
  int chroma_quality;
};