Image compression, correct image rotation angle.
$ npm install file2canvas
import file2canvas from "file2canvas";
file2canvas(file, options)
.then((canvas) => {
// code
})
.catch((errorType) => {
// code
});input choose file
| Param | Type | Default | require | Description |
|---|---|---|---|---|
| maxSize | Number | 0 |
false | file maxSize |
| width | Number | -- |
false | output canvas width |
| background | String | transparent |
false | canvas background |
| code | des |
|---|---|
| 100 | File does not exist or format is wrong |
| 101 | The file size exceeds the specified size |