Skip to content

Commit 06376e5

Browse files
committed
update README.md
1 parent 1f8739b commit 06376e5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ or
5252
const options = {
5353
maxSizeMB: number, // (default: Number.POSITIVE_INFINITY)
5454
maxWidthOrHeight: number, // compressedFile will scale down by ratio to a point that width or height is smaller than maxWidthOrHeight (default: undefined)
55+
// but, automatically reduce the size to smaller than the maximum Canvas size supported by each browser.
56+
// Please check the Cabeat part for details.
5557
onProgress: Function, // optional, a function takes one progress argument (percentage from 0 to 100)
5658
useWebWorker: boolean, // optional, use multi-thread web worker, fallback to run in main-thread (default: true)
5759

@@ -64,6 +66,20 @@ const options = {
6466

6567
imageCompression(file: File, options): Promise<File>
6668
```
69+
70+
#### Caveat ####
71+
Each browser limits [the maximum size](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#maximum_canvas_size) of a Canvas object. <br/>
72+
So, we resize the image to less than the maximum size that each browser restricts. <br/>
73+
(However, the `proportion/ratio` of the image remains.)
74+
75+
| Browser | Maximum height | Maximum width | Maximum area |
76+
|---|---|---|---|
77+
| Chrome | 32,767 pixels | 32,767 pixels | 268,435,456 pixels (i.e., 16,384 x 16,384) |
78+
| Firefox | 32,767 pixels | 32,767 pixels | 472,907,776 pixels (i.e., 22,528 x 20,992) |
79+
| Safari | 32,767 pixels | 32,767 pixels | 268,435,456 pixels (i.e., 16,384 x 16,384) |
80+
| IE | 8,192 pixels | 8,192 pixels | ? |
81+
| Etc | ? | ? | ? |
82+
6783
### Helper function ###
6884
- for advanced users only, most users won't need to use the helper functions
6985
```javascript

0 commit comments

Comments
 (0)