Files
squoosh/codecs/mozjpeg_enc
Jake Archibald 43def798e1 Two workers & worker termination (#198)
* Refactoring codecs

* Plugging in new processor

* Fixing decorator

* MozJPEG free issue

* Better worker aborting, and terminate workers that aren't used for 10 seconds

* Better comment

* Ooops, half-typed comment

* Uncommenting problematic line

* Surma fixed it!

* Abstracting WASM initialisation

* Better comment

* Don't need this.

* Adding ticket

* noInitalRun

* Reverting MozJPEG issue demo

* Making a const for worker timeout

* Inline docs

* Bail early rather than nesting

* Addressing nits
2018-10-28 09:17:43 +00:00
..
2018-10-12 10:53:33 +01:00
2018-09-26 12:31:26 +01:00
2018-09-26 12:31:26 +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;
};