Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-convert-image

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41
decreased by-21.15%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 01 Sep 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc