0.5.0 • Published 6 years ago

react-convert-image v0.5.0

Weekly downloads
48
License
MIT
Repository
github
Last release
6 years ago

react-convert-image

A quick proof-of-concept React component for image format conversion. Currently converts to WebP. Browser capability dependent.

Click here to see an example implementation.

Installation

npm install react-convert-image

Usage

import React from "react";
import ConvertImage from "react-convert-image";

class Component extends React.Component {
  handleConvertedImage(url) {
    console.log(url);
  }

  render() {
    return (
      <ConvertImage
        image="hello-world.jpg"
        onConversion={this.handleConvertedImage}
      />
    );
  }
}

Props

proptyperequireddefaultdescription
imagestringYesPath to image or data URL
onConversionfunctionYesCalled with base64 data URL of converted image
formatstringNowebpTarget image format e.g 'webp', 'jpeg', 'png'
qualitynumberNo0.92A Number between 0 and 1 indicating image quality if the format is jpeg or webp

License

MIT

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago