![]() See for browser compatibility of "OffscreenCanvas" API. ![]() If the browser does not support "OffscreenCanvas" API, the main thread is used instead. The browser needs to support "OffscreenCanvas" API in order to take advantage of non-blocking compression. Remarks for compression to work in Web Worker The webp compression is supported on major browsers. You can include the following script to load the core-js polyfill: You can include the core-js polyfill in your project. If you need to support browsers that do not support new ES features like IE. This library uses ES features such as Promise API, globalThis. ![]() copyExifWithoutOrientation ( copyExifFromFile: File, copyExifToFile: File ): Promise // based on Browsers support getExifOrientation ( file: File ): Promise // based on imageCompression. canvasToFile ( canvas: HTMLCanvasElement | OffscreenCanvas, fileType: string, fileName: string, fileLastModified: number, quality? : number ): Promise imageCompression. drawFileInCanvas ( file: File, options? : Options ): Promise imageCompression. drawImageInCanvas ( img: HTMLImageElement, fileType? : string ): HTMLCanvasElement | OffscreenCanvas imageCompression. loadImage ( url: string ): Promise imageCompression. getFilefromDataUrl ( dataUrl: string, filename: string, lastModified? : number ): Promise imageCompression. getDataUrlFromFile ( file: File ): Promise imageCompression. To use this feature, please check the browser compatibility: (However, the proportion/ratio of the image remains.) Abort / Cancel Compression So, we resize the image to less than the maximum size that each browser restricts. you should provide one of maxSizeMB, maxWidthOrHeight in the options const options: Options = imageCompression ( file: File, options: Options ): Promise CaveatĮach browser limits the maximum size of a browser Canvas object.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |