@@ -50,25 +50,25 @@ const options = {
5050 onProgress: Function , // optional, a function takes one progress argument (percentage from 0 to 100)
5151 useWebWorker: boolean, // optional, use multi-thread web worker, fallback to run in main-thread (default: true)
5252
53- // following options are for advanced user
53+ // following options are for advanced users
5454 maxIteration: number, // optional, max number of iteration to compress the image (default: 10)
5555 exifOrientation: number, // optional, see https://stackoverflow.com/a/32490603/10395024
5656 fileType: string, // optional, fileType override
5757 initialQuality: number // optional, initial quality value between 0 and 1 (default: 1)
5858}
5959
60- imageCompression (file: File , options): Promise < File | Blob >
60+ imageCompression (file: File , options): Promise < File >
6161```
6262### Helper function ###
63- - for advanced user only, most user won't need to use the helper functions
63+ - for advanced users only, most users won't need to use the helper functions
6464``` javascript
65- imageCompression .getDataUrlFromFile (file: File | Blob ): Promise < base64 encoded string>
65+ imageCompression .getDataUrlFromFile (file: File ): Promise < base64 encoded string>
6666imageCompression .getFilefromDataUrl (dataUrl: string, filename: string, lastModified?: number): Promise < File >
6767imageCompression .loadImage (url: string): Promise < HTMLImageElement >
6868imageCompression .drawImageInCanvas (img: HTMLImageElement ): HTMLCanvasElement | OffscreenCanvas
69- imageCompression .drawFileInCanvas (file: File | Blob ): Promise < [ImageBitmap | HTMLImageElement , HTMLCanvasElement | OffscreenCanvas]>
70- imageCompression .canvasToFile (canvas: HTMLCanvasElement | OffscreenCanvas, fileType: string, fileName: string, fileLastModified: number, quality?: number): Promise < File | Blob >
71- imageCompression .getExifOrientation (file: File | Blob ): Promise < number> // based on https://stackoverflow.com/a/32490603/10395024
69+ imageCompression .drawFileInCanvas (file: File ): Promise < [ImageBitmap | HTMLImageElement , HTMLCanvasElement | OffscreenCanvas]>
70+ imageCompression .canvasToFile (canvas: HTMLCanvasElement | OffscreenCanvas, fileType: string, fileName: string, fileLastModified: number, quality?: number): Promise < File >
71+ imageCompression .getExifOrientation (file: File ): Promise < number> // based on https://stackoverflow.com/a/32490603/10395024
7272```
7373
7474## Usage ##
@@ -148,11 +148,7 @@ You can include the following script to load the Promise polyfill:
148148```
149149
150150## Typescript type definitions ##
151- ```
152- npm install --save-dev @types/browser-image-compression
153- or
154- yarn add --dev @types/browser-image-compression
155- ```
151+ Typescript definitions are included in the package & referenced in the ` types ` section of the ` package.json `
156152
157153## Contribution ##
1581541 . fork the repo and git clone it
0 commit comments