jpck

streamable mozjpeg jpegtran

Usage no npm install needed!

<script type="module">
  import jpck from 'https://cdn.skypack.dev/jpck';
</script>

README

jpck

a streamable wrapper around js-mozjpegs jpegtran.

you can use all jpegtran command line options in the object passed to jpck(options).

be aware that js-mozjpeg is blocking. with the limit option you can set a maximum number of bytes for the input jpeg to be optimized. larger jpegs will just be passe through.

usage


var fs = require("fs");
var jpck = require("jpck");

fs.createReadStream("./in.jpg").pipe(jpck({ optimize: true, copy: "none", fastcrush: true, limit: 102400 })).pipe(fs.createWriteStream("./out.jpg"));