Socket
Socket
Sign inDemoInstall

react-convert-image

Package Overview
Dependencies
8
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-convert-image

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


Version published
Weekly downloads
20
decreased by-57.45%
Maintainers
1
Install size
444 kB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 01 Sep 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc