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

react-avatar-editor

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-avatar-editor

Avatar / profile picture component. Resize and crop your uploaded image using a intuitive user interface.

  • 13.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is react-avatar-editor?

The react-avatar-editor npm package is a React component for image cropping and manipulation. It allows users to upload images, zoom, rotate, and position them within a circular or rectangular frame, making it ideal for creating avatars or profile pictures.

What are react-avatar-editor's main functionalities?

Image Cropping

This feature allows users to crop an image to a specified width and height, with an optional border and background color. The `scale` prop can be used to zoom in and out of the image.

import React from 'react';
import AvatarEditor from 'react-avatar-editor';

class MyEditor extends React.Component {
  render() {
    return (
      <AvatarEditor
        image="path/to/image.jpg"
        width={250}
        height={250}
        border={50}
        color={[255, 255, 255, 0.6]} // RGBA
        scale={1.2}
      />
    );
  }
}

export default MyEditor;

Image Rotation

This feature allows users to rotate the image by a specified number of degrees. The `rotate` prop can be used to set the rotation angle.

import React from 'react';
import AvatarEditor from 'react-avatar-editor';

class MyEditor extends React.Component {
  render() {
    return (
      <AvatarEditor
        image="path/to/image.jpg"
        width={250}
        height={250}
        border={50}
        color={[255, 255, 255, 0.6]} // RGBA
        scale={1.2}
        rotate={90}
      />
    );
  }
}

export default MyEditor;

Image Positioning

This feature allows users to position the image within the frame. The `position` prop takes an object with `x` and `y` values ranging from 0 to 1, representing the position of the image within the frame.

import React from 'react';
import AvatarEditor from 'react-avatar-editor';

class MyEditor extends React.Component {
  render() {
    return (
      <AvatarEditor
        image="path/to/image.jpg"
        width={250}
        height={250}
        border={50}
        color={[255, 255, 255, 0.6]} // RGBA
        scale={1.2}
        position={{ x: 0.5, y: 0.5 }}
      />
    );
  }
}

export default MyEditor;

Other packages similar to react-avatar-editor

Keywords

FAQs

Package last updated on 20 Dec 2023

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