https://github.com/samirpaulb/compress-image
Compress PNG, JPG, GIF, WEBP, SVG, TIFF, BMP images online in seconds for free! Resize images by pixels or percentages quality or Width/Height
https://github.com/samirpaulb/compress-image
compress-image compress-images frontend html javascript
Last synced: 8 months ago
JSON representation
Compress PNG, JPG, GIF, WEBP, SVG, TIFF, BMP images online in seconds for free! Resize images by pixels or percentages quality or Width/Height
- Host: GitHub
- URL: https://github.com/samirpaulb/compress-image
- Owner: SamirPaulb
- License: mit
- Created: 2021-06-20T12:30:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T06:49:08.000Z (about 3 years ago)
- Last Synced: 2025-05-12T23:44:15.931Z (8 months ago)
- Topics: compress-image, compress-images, frontend, html, javascript
- Language: HTML
- Homepage: https://samirpaul1.github.io/compress-image
- Size: 3.71 MB
- Stars: 16
- Watchers: 1
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Compress-Image
Compressing image with HTML5.
## Browser Compatibility
| Browser | Version |
| :------ | :-----: |
| IE | 10+ |
| Chrome | 22+ |
| Firefox | 16+ |
| Safari | 8+ |
| Android Browser | 4+ |
| Chrome for Android | 32+ |
| iOS Safarri | 7+ |
## Dependencies
1. [Exif.js](https://github.com/exif-js/exif-js)
2. ES6 Promise polyfill.
## Install
Via npm:
```
npm install canvas-compress --save
```
Via bower:
```
bower install canvas-compress --save
```
## Usage
```javascript
import { CanvasCompress } from 'canvas-compress';
let compressor = new CanvasCompress(options);
compressor.process(fileBlob).then(({ source, result }) => {
const { blob, width, height } = source;
const { blob, width, height } = result;
...
});
```
## Options
There're four optional properties for options object:
- `type`: output type, default is `image/jpeg`
- `width`: output width, default is `1000`
- `height`: ouput height, default is `618`
- `quality`: output quality, defalut is `0.9`
## License
MIT.