npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-image-watermark-pro

v1.0.1

Published

A React component for adding watermarks to images using canvas rendering

Readme

React Image Watermark

A React component for adding watermarks to images using canvas rendering. This component renders images as canvas elements to prevent right-click saving and overlays customizable watermarks.

Features

  • 🖼️ Canvas Rendering: Images are rendered as canvas to prevent right-click saving
  • 📍 Flexible Positioning: 5 different watermark positions (top-left, top-right, bottom-left, bottom-right, center)
  • 🎨 Custom Styling: Full control over text appearance (font, size, color, opacity)
  • 🔄 Rotation Support: Rotate watermarks at any angle
  • 📐 Offset Control: Fine-tune watermark positioning with X/Y offsets
  • 🎯 TypeScript Support: Full TypeScript definitions included
  • 📦 Lightweight: No external dependencies beyond React

Installation

npm install react-image-watermark-pro-pro

Usage

Basic Example

import React from "react";
import { ImageWatermark } from "react-image-watermark-pro";

const App = () => {
  return (
    <ImageWatermark
      src="https://example.com/image.jpg"
      alt="My watermarked image"
      width={400}
      height={300}
      watermark={{
        text: "© 2024 My Company",
        position: "bottom-right",
        opacity: 0.7,
        fontSize: 16,
        color: "white",
      }}
    />
  );
};

Advanced Example with Custom Styling

import React from "react";
import { ImageWatermark } from "react-image-watermark-pro";

const App = () => {
  return (
    <ImageWatermark
      src="https://example.com/image.jpg"
      alt="Confidential document"
      width={600}
      height={400}
      watermark={{
        text: "CONFIDENTIAL",
        position: "center",
        opacity: 0.3,
        fontSize: 32,
        color: "red",
        rotation: -45,
        fontFamily: "Arial Black, sans-serif",
        offsetX: 0,
        offsetY: 0,
      }}
      style={{ border: "2px solid #ccc", borderRadius: "8px" }}
      canvasStyle={{ filter: "brightness(0.9)" }}
      onLoad={() => console.log("Image loaded successfully")}
      onError={(error) => console.error("Failed to load image:", error)}
    />
  );
};

API Reference

ImageWatermark Props

| Prop | Type | Default | Description | | ------------- | ------------------------ | -------- | ---------------------------------------- | | src | string | - | Required. Image source URL | | alt | string | '' | Alt text for accessibility | | width | number \| string | 'auto' | Canvas width | | height | number \| string | 'auto' | Canvas height | | watermark | WatermarkOptions | - | Required. Watermark configuration | | className | string | - | CSS class name for the canvas | | style | CSSProperties | - | Inline styles for the canvas | | canvasStyle | CSSProperties | - | Additional canvas-specific styles | | imageStyle | CSSProperties | - | Styles applied to the image (deprecated) | | onLoad | () => void | - | Callback when image loads successfully | | onError | (error: Error) => void | - | Callback when image fails to load |

WatermarkOptions

| Option | Type | Default | Description | | ------------ | -------------------------------------------------------------------------- | ---------------------------- | ------------------------------- | | text | string | - | Required. Watermark text | | position | 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right' \| 'center' | 'center' | Watermark position | | opacity | number | 0.7 | Text opacity (0-1) | | fontSize | number | 24 | Font size in pixels | | fontFamily | string | 'Arial, sans-serif' | Font family | | color | string | 'rgba(255, 255, 255, 0.7)' | Text color | | rotation | number | 0 | Rotation angle in degrees | | offsetX | number | 0 | Horizontal offset from position | | offsetY | number | 0 | Vertical offset from position |

Position Examples

// Top-left corner
watermark={{ text: "DRAFT", position: "top-left" }}

// Top-right corner
watermark={{ text: "© 2024", position: "top-right" }}

// Bottom-left corner
watermark={{ text: "CONFIDENTIAL", position: "bottom-left" }}

// Bottom-right corner
watermark={{ text: "My Company", position: "bottom-right" }}

// Center (default)
watermark={{ text: "WATERMARK", position: "center" }}

Styling Examples

// Rotated watermark
watermark={{ text: "CONFIDENTIAL", rotation: -45 }}

// Custom font and color
watermark={{
  text: "PROPRIETARY",
  fontFamily: "Impact, sans-serif",
  color: "red",
  fontSize: 32
}}

// Semi-transparent
watermark={{ text: "DRAFT", opacity: 0.3 }}

// With offset
watermark={{
  text: "© 2024",
  position: "bottom-right",
  offsetX: -10,
  offsetY: -10
}}

Development

Setup

# Install dependencies
npm install

# Start development mode
npm run dev

# Build for production
npm run build

Testing Locally

  1. Build the package: npm run build
  2. In your test project: npm install /path/to/react-image-watermark
  3. Import and use the component