An open API service indexing awesome lists of open source software.

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

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.