You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,11 @@
1
+
## v2.0.0 (13 Apr 2022)
2
+
* docs: add CSS animation to example html for showing main thread status
3
+
* feature: support AbortController (abort / cancel during compression) [#101](https://github.com/Donaldcwl/browser-image-compression/issues/101)
4
+
* feature: options.alwaysKeepResolution (default: false) - keep the resolution (width and height) during compression and reduce the quality only (note that options.maxWidthOrHeight is still applied if set) [#127](https://github.com/Donaldcwl/browser-image-compression/issues/127)
5
+
* fixed: Main thread is blocked on Mac device for options.useWebWorker=true [#139](https://github.com/Donaldcwl/browser-image-compression/issues/139)
6
+
* updated: dropped core-js to reduce bundle size [#138](https://github.com/Donaldcwl/browser-image-compression/issues/138)
7
+
* updated: options.useWebWorker default set to true
8
+
1
9
## v1.0.17 (15 Nov 2021)
2
10
* feature: apply white background to transparent PNG > JPG conversion if options.fileType is image/jpeg or image/jpg [#119](https://github.com/Donaldcwl/browser-image-compression/issues/119)
3
11
* fixed: Fixed image cropped on Safari [#118](https://github.com/Donaldcwl/browser-image-compression/issues/118)
Javascript module to be run in the web browser for image compression.
7
7
8
-
## Features ##
9
-
- You can use this module to compress jpeg and png image by reducing **resolution** or **storage size** before uploading to application server to save bandwidth.
10
-
-**Multi-thread** (web worker) non-blocking compression are supported through options.
11
-
## Demo / Example ##
12
-
open https://donaldcwl.github.io/browser-image-compression/example/basic.html
13
-
14
-
or check the "[example]" folder in this repo
15
-
## Install ##
16
-
You can download imageCompression from the [dist folder][dist]. Alternatively, you can install it via yarn or npm
- You can use this module to compress jpeg and png images by reducing **resolution** or **storage size** before uploading to the application server to save bandwidth.
10
+
-**Multi-thread** (web worker) non-blocking compression is supported through options.
28
11
29
-
## How to use this module in your project? ##
30
-
#### Use as ES module ####
31
12
32
-
(can be used in framework like React, Angular, Vue etc)
13
+
## Upgrade to version 2
14
+
Note that core-js is dropped in version 2, please read the [IE support](#ie-support) section.
If this project help you reduce time to develop, you can buy me a cup of coffee :)
106
+
If this project helps you reduce the time to develop, you can buy me a cup of coffee :)
103
107
104
108
<ahref="https://donaldcwl.github.io/donation/"target="_blank"><imgsrc="https://cdn.buymeacoffee.com/buttons/v2/default-red.png"alt="Buy Me A Coffee"height=60width=217 ></a>
105
-
## API ##
106
-
### Main function ###
109
+
110
+
## API
111
+
### Main function
107
112
```javascript
108
113
// you should provide one of maxSizeMB, maxWidthOrHeight in the options
maxWidthOrHeight: number, // compressedFile will scale down by ratio to a point that width or height is smaller than maxWidthOrHeight (default: undefined)
112
-
// but, automatically reduce the size to smaller than the maximum Canvas size supported by each browser.
113
-
// Please check the Caveat part for details.
114
-
onProgress:Function, // optional, a function takes one progress argument (percentage from 0 to 100)
115
-
useWebWorker: boolean, // optional, use multi-thread web worker, fallback to run in main-thread (default: true)
maxWidthOrHeight: number, // compressedFile will scale down by ratio to a point that width or height is smaller than maxWidthOrHeight (default: undefined)
117
+
// but, automatically reduce the size to smaller than the maximum Canvas size supported by each browser.
118
+
// Please check the Caveat part for details.
119
+
onProgress:Function, // optional, a function takes one progress argument (percentage from 0 to 100)
120
+
useWebWorker: boolean, // optional, use multi-thread web worker, fallback to run in main-thread (default: true)
121
+
122
+
signal: AbortSignal, // options, to abort / cancel the compression
116
123
117
124
// following options are for advanced users
118
-
maxIteration: number, // optional, max number of iteration to compress the image (default: 10)
119
-
exifOrientation: number, // optional, see https://stackoverflow.com/a/32490603/10395024
120
-
fileType: string, // optional, fileType override
121
-
initialQuality: number // optional, initial quality value between 0 and 1 (default: 1)
125
+
maxIteration: number, // optional, max number of iteration to compress the image (default: 10)
126
+
exifOrientation: number, // optional, see https://stackoverflow.com/a/32490603/10395024
| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions
149
186
187
+
### IE support
188
+
This library uses ES features such as Promise API, globalThis. If you need to support browsers that do not support new ES features like IE. You can include the core-js polyfill in your project.
189
+
190
+
You can include the following script to load the core-js polyfill:
The browser need to support "OffscreenCanvas" API in order to take advantage of non-blocking compression. If browser do not support "OffscreenCanvas" API, main thread is used instead. See https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas#browser_compatibility for browser compatibility of "OffscreenCanvas" API.
197
+
The browser needs to support "OffscreenCanvas" API in order to take advantage of non-blocking compression. If the browser does not support "OffscreenCanvas" API, the main thread is used instead. See https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas#browser_compatibility for browser compatibility of "OffscreenCanvas" API.
152
198
153
-
## Typescript type definitions ##
199
+
200
+
## Typescript type definitions
154
201
Typescript definitions are included in the package & referenced in the `types` section of the `package.json`
155
202
156
-
## Contribution ##
203
+
204
+
## Contribution
157
205
1. fork the repo and git clone it
158
206
2. run `npm run watch` # it will watch code change in lib/ folder and generate js in dist/ folder
0 commit comments