image-resize-tools
Development Setup
# install deps npm i image-resize-tools --save # compress files npm installnpm run compress
Seven methods in tools
Include the library
in the browser:
in the node:
const imageResizeTools =
Use examples
{ var file = documentfiles0; console; imageResizeTools}
Use Promise
Use too many callback functions does not look elegant,as follows:
var canvas = imageResizeTools;imageResizeTools
So, we recommend use resize.promise.js
,as follows:
in the browser, we change the script:
in the node, we default use promise.
use like this:
imageResizeTools })
or like this:
const canvas = await imageResizeTools;const dataURL = await imageResizeTools;const file = await imageResizeTools;const data = await imageResizeTools;const image = await imageResizeTools;//do something