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

measure-png-overlay

v1.0.6

Published

CLI tool to detect transparent areas in overlay images and output JSON

Readme

PNG Transparent Area Measurement Tool

A web-based tool for measuring transparent areas in images, defining printable areas, and calculating custom margins. This tool helps designers and developers accurately set up print files.

Features

  • Upload PNG, JPEG, or WEBP images.
  • Automatic detection of one or more transparent areas.
  • Manual adjustment of detected transparent areas by dragging their edges.
  • Define a printable area based on product aspect ratio and bleed values.
  • Align the printable area (center, top, bottom, left, right).
  • For single printable areas, apply rotation and scaling.
  • Interactively adjust the final print area by dragging its corners to create custom margins.
  • Add customizable vertical and horizontal guide lines for precise alignment.
  • Zoom in and out of the canvas for a more detailed view.
  • Real-time preview of all adjustments.
  • Generate normalized (PO) and pixel-based (Template) coordinates.
  • Calculate and display custom margins and final corner positions.

Workflow

graph TD
    A[Start] --> B[Upload Image]
    B --> C[Set Parameters: Product Size, Bleed, Alignment]
    C --> D[Click Start Detection]
    D --> E{Automatic Detection}
    E --> F[Adjust Detection Area Edges - Optional]
    F --> G[Click Confirm Detection Area]
    G --> H[Interactive Printable Area Generated]
    H --> I{Single Area?}
    I -- Yes --> J[Apply Rotation & Scale - Optional]
    I -- No --> K[Adjust Corners for Custom Margins - Optional]
    J --> K
    K --> L[Click Calculate Margins]
    L --> M[View/Copy PO, Template & Positions Info]
    M --> N[End]

Usage

  1. Upload Image

    • Click the file input button.
    • Select a PNG, JPEG, or WEBP image.
    • The image will be displayed in the preview area.
  2. Set Parameters

    • Enter Product Width, Product Height, and Bleed. These are used to calculate the aspect ratio of the printable area.
    • Select an Alignment for the printable area within the transparent area.
    • (Optional) Enter Vertical Guides and Horizontal Guides as comma-separated values between 0 and 1 (e.g., 0.25, 0.75) to display guide lines. A center line is always shown.
  3. Detect Transparent Area

    • Click the "Start Detection" button.
    • The tool will automatically detect transparent area(s).
    • A green rectangle will show the detected area(s).
  4. Adjust Detection (Optional)

    • If the automatic detection needs adjustment, you can drag the edges of the green rectangle(s).
    • Click and drag any edge to modify a detection area.
  5. Confirm Detection

    • Click the "Confirm Detection Area" button.
    • This generates the printable area based on your parameters.
    • An interactive magenta shape with adjustable corners will appear.
    • If a single area was detected, Rotation and Scale controls will also become available.
  6. Adjust Printable Area (Optional)

    • Use the Rotation and Scale sliders to transform the printable area (single area only).
    • Drag the corners of the magenta shape to create custom margins. This works for single or multiple areas.
  7. Calculate Margins

    • Click the "Calculate Margins" button.
    • The tool calculates any custom margins you created by adjusting the corners.
    • The PO Info and Template Info panels will be updated to include a margins array if adjustments were made.
    • The Positions Info panel will appear, showing the final pixel coordinates of the four corners of the printable area(s).

Output Format

PO Info Format

The margins array is optional and appears only after adjustment and calculation. It contains 8 values representing the x and y offsets for the top-left, top-right, bottom-right, and bottom-left corners, normalized to the image dimensions.

[
    {
        "x": 0.1234,
        "y": 0.5678,
        "w": 0.4321,
        "h": 0.8765,
        "margins": [0.01, 0.02, -0.01, 0.025, -0.015, -0.02, 0.01, -0.025]
    }
]

Template Info Format

The margins array is optional and contains 8 values representing the pixel offsets for the four corners.

[
    {
        "width": 1000,
        "height": 800,
        "left": 123,
        "top": 456,
        "right": 555,
        "bottom": 912,
        "margins": [10, 20, -10, 25, -15, -20, 10, -25]
    }
]

Positions Info Format

This shows the final absolute pixel coordinates for each of the four corners of the printable area(s).

[
    {
        "tlx": 133,
        "tly": 476,
        "trx": 545,
        "try": 481,
        "blx": 113,
        "bly": 892,
        "brx": 540,
        "bry": 887
    }
]

Samples

Sample Image Sample Image Sample Image

Notes

  • For best results with automatic detection, use images with clear, high-contrast transparent areas.
  • The bleed value should be entered in the same unit as the product dimensions.
  • All measurements are calculated relative to the image dimensions.