
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
react-mask-editor
Advanced tools
A drop-in component to add simple image mask editing to your React application. Uses <canvas> for rendering & interaction, with optional support for customizing how the mask is displayed & edited.
You give React Mask Editor an image, and it lets the user 'scribble' over that image to create a 1-bit (black or white) mask. Think Photoshop, Lightroom, or Aperture.

First, some setup:
yarn install react-mask-editorimport { MaskEditor, toMask } from "react-mask-editor";node_modules/react-mask-editor/dist/style.css somewhere in your bundle.Usage:
const MyComponent: React.FC<{}> = () => {
const canvas = React.useRef<HTMLCanvasElement>();
return <>
<MaskEditor
src="https://placekitten/256/256"
canvasRef={canvas}
/>
<button
onClick={() => console.log(toMask(canvas.current))}
>
Get Mask
</button>
</>
}
You can customize the editor using additional, optional props:
| Prop | Description | Default |
|---|---|---|
cursorSize | Radius (in pixels) of the brush for editing the mask | 10 |
onCursorSizeChange | Callback fired when the user changes the brush size via mousewheel. If not provided, mouse wheel events will be ignored. | undefined |
maskOpacity | CSS opacity, decimal between 0 – 1 | 0.75 |
maskColor | A hex color (with or without leading '#'). | #23272d |
maskBlendMode | The CSS blending mode for the mask layer. Doesn't affect the output mask, just how it renders on top of your source image. | normal |
FAQs
General-purpose mask editor for React image manipulation apps
We found that react-mask-editor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.