
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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-editor
import { 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
The npm package react-mask-editor receives a total of 24 weekly downloads. As such, react-mask-editor popularity was classified as not popular.
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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.