fei.js

image preprocessor

Usage no npm install needed!

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

README

fei.js

gzip size

Travis Codacy Badge

devDependencies Issues Issues GitHub last commit GitHub Release Date

styled with prettier MIT license

API

fei(input[, options])

input

Type: Blob

options

Type: Object

options.always

Type: Boolean, Default: false

always process with canvas

options.fixOrientation

Type: Boolean, Default: true

detect jpeg orientation, and rotate if needed

options.maxWidth

Type: Number, Default: 1500

maxWidth of image, set to Infinity to disable

options.maxHeight

Type: Number, Default: 1500

maxHeight of image, set to Infinity to disable

options.quality

Type: Number, Default: undefined

qualityArgument for HTMLCanvasElement#toBlob()

see: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob

options.preferSmaller

Type: Boolean, Default: false

if no rotate and resize, compare original blob and result, returns smaller one

Todo List

  • allow skip Orientation fix, via fixOrientation
  • support OffscreenCanvas
  • quality test
  • support options.always
  • support options.preferSmaller
  • support Worker