https://github.com/akiyamka/webpconv-es6
Small and simple webp image format converter library
https://github.com/akiyamka/webpconv-es6
image-compression image-convert image-converter
Last synced: 25 days ago
JSON representation
Small and simple webp image format converter library
- Host: GitHub
- URL: https://github.com/akiyamka/webpconv-es6
- Owner: Akiyamka
- License: mit
- Created: 2017-12-30T18:03:27.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-13T14:00:57.000Z (over 8 years ago)
- Last Synced: 2025-02-14T04:55:12.616Z (over 1 year ago)
- Topics: image-compression, image-convert, image-converter
- Language: C
- Homepage:
- Size: 11.4 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webpconv-es6
A small [node.js](http://nodejs.org) library for working with [WebP](https://developers.google.com/speed/webp/docs/using) format. Supports the Promise API.
### Example
Convert .png image to .webp and save
```js
const converter = require('webpconverter');
const fs = require('fs');
let options = '-q 80';
converter.cwebp('path/to/image.png', options, 'path/to/output.webp')
.then((res) => {
console.log(res) // 'path/to/output.webp'
}).catch((err) => {
throw new Error(err);
});
```
Convert .png image to .webp without saving
```js
const converter = require('webpconverter');
const fs = require('fs');
let options = '-q 80';
converter.cwebp('path/to/image.png', options)
.then((res) => {
// Do something with data
fs.writeFile(path.join(__dirname, 'path/to/output.webp'), res, 'hex');
}).catch((err) => {
throw new Error(err);
});
```
Convert .webp image to .png format without saving
```js
const converter = require('webpconverter');
const fs = require('fs');
return converter.dwebp('path/to/image.webp')
.then((res) => {
// Do something with data
fse.writeFile(path.join(__dirname, 'path/to/output.png'), res, 'hex');
}).catch((err) => {
throw new Error(err);
});
```
### API
- [cwebp](https://developers.google.com/speed/webp/docs/cwebp) - image to webp.
- [dwebp](https://developers.google.com/speed/webp/docs/dwebp) - webp to image.
- [gif2webp](https://developers.google.com/speed/webp/docs/gif2webp) - gif animated image to animated WebP.
- [webpmux](https://developers.google.com/speed/webp/docs/webpmux) - work in progress! Not supproted yet. Create animated WebP files from non-animated WebP images, extract frames from animated WebP images, and manage XMP/EXIF metadata and ICC profile.
### Converter version
libwebp 0.6.1 (2017, November)
## License
https://developers.google.com/speed/webp/download?hl=ru
[MIT](LICENSE)