Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mozmorris/react-convert-image
Convert image format in the browser.
https://github.com/mozmorris/react-convert-image
convert format jpeg png react webp
Last synced: 3 months ago
JSON representation
Convert image format in the browser.
- Host: GitHub
- URL: https://github.com/mozmorris/react-convert-image
- Owner: mozmorris
- Created: 2018-08-24T11:05:50.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T09:14:52.000Z (about 2 years ago)
- Last Synced: 2024-10-07T17:48:41.276Z (3 months ago)
- Topics: convert, format, jpeg, png, react, webp
- Language: JavaScript
- Homepage: https://www.mozmorris.com/react-convert-image/
- Size: 2.05 MB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-convert-image
https://www.npmjs.com/package/react-convert-image
React component for image format conversion. Currently converts to WebP. Browser capability dependent.
Demo: http://www.mozmorris.com/react-convert-image
## Installation
```
npm install react-convert-image
```## Usage
```javascript
import React from "react";
import ConvertImage from "react-convert-image";class Component extends React.Component {
handleConvertedImage(url) {
console.log(url);
}render() {
return (
);
}
}
```### Props
| prop | type | required | default | description |
| ----------------- | -------- | -------- | -------- | ------------------------------------------------------------------------------- |
| image | string | Yes | | Path to image or data URL |
| onConversion | function | Yes | | Called with base64 data URL of converted image |
| format | string | No | webp | Target image format e.g 'webp', 'jpeg', 'png' |
| quality | number | No | 0.92 | A Number between 0 and 1 indicating image quality if the format is jpeg or webp |## License
MIT