Wrapper for pica to work with blobs, with some sugar.
This is pica
wrapper for convenient work with images from file input fields.
While pica
works with raw bitmaps, this package operates with "image files".
Additional features are:
- [jpeg] Apply orientation to downscaled result.
- [jpeg] Keep metadata, but with patched orientation & removed original color profile.
- Easy to monkey-patch for your needs.
npm install pica
const reduce = require('image-blob-reduce')();
//...
reduce.toBlob(image_blob, { max: 1000 })
.then(blob => { ... });
Create new reducer. Options:
pica
- instance ofpica
, if you wish different defaults or shareable webworkers pool.
Short call: require('image_blob_reduce')()
Downscale image to fit into max
*max
size. If blob contains jpeg, then
orientation is applied and metadata from original image reused (with minimal
change).
The same as .toBlob()
, but with canvas output.
Reexport of require('pica')
, for convenience.