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

@cadit-app/image-extrude

v0.4.4

Published

Image Extrude for CADit - Extrude shapes from SVG or bitmap images

Readme

@cadit-app/image-extrude

Extrude 3D shapes from SVG or bitmap images. Supports both tracing (for raster images) and sampling (for SVGs).

Image Extrude Preview

Features

  • Trace mode: Convert any bitmap image (PNG, JPG) to 3D by tracing edges (browser only)
  • Sample mode: High-fidelity conversion of SVG files to 3D
  • Configurable size: Set maximum width to control output dimensions
  • Despeckle: Remove small artifacts during tracing
  • CLI support: Generate GLB and 3MF files from command line (SVG sample mode)

Note: Trace mode for bitmap images currently only works in the browser (CADit). The CLI only supports SVG files with sample mode.

Installation

npm install @cadit-app/image-extrude

Usage

As a CADit Script

Import this script in CADit by adding the GitHub repository URL.

CLI Usage

# Generate GLB from default star shape
npx tsx cli.ts output.glb

# Generate from a specific image
npx tsx cli.ts output.glb --image=logo.svg --height=2 --maxWidth=50

# Generate 3MF
npx tsx cli.ts output.3mf --image=photo.png --mode=trace

CLI Options

| Option | Description | Default | |--------|-------------|---------| | --image=<path> | Path to image file (SVG, PNG, JPG) | Built-in star | | --height=<mm> | Extrusion height in mm | 1 | | --maxWidth=<mm> | Maximum width in mm | 50 | | --mode=<trace\|sample> | Processing mode | trace | | --despeckle=<size> | Despeckle size for tracing | 2 |

Programmatic Usage

import imageExtrude from '@cadit-app/image-extrude';

// Use the defineParams API
const result = await imageExtrude.main({
  mode: 'trace',
  imageFile: {
    dataUrl: 'data:image/png;base64,...',
    fileType: 'image/png',
    fileName: 'logo.png'
  },
  height: 2,
  maxWidth: 50,
  despeckleSize: 2
});

Creating CrossSections for Embedding

import { makeCrossSection } from '@cadit-app/image-extrude';

const crossSection = await makeCrossSection({
  imageFile: { dataUrl: '...', fileType: 'image/svg+xml' },
  mode: 'sample',
  maxWidth: 30
});

// Use in your own maker
const manifold = crossSection.extrude(5);

Parameters

| Parameter | Type | Description | |-----------|------|-------------| | mode | 'trace' \| 'sample' | Trace for bitmaps, Sample for SVGs | | imageFile | object | Image data with dataUrl, fileType, fileName | | height | number | Extrusion height in mm | | maxWidth | number | Maximum width in mm | | despeckleSize | number | Remove spots smaller than this (trace only) |

Build & Bundle

This package ships as a pre-bundled ES module for browser use.

Why we bundle

CADit's script runtime uses esbuild to bundle external scripts at runtime, fetching dependencies from CDN (esm.sh). Some dependencies like potrace (which uses jimp for image processing) don't work correctly when fetched from CDN due to complex browser shims.

By pre-bundling at publish time, we ensure:

  • All dependencies are resolved correctly at build time
  • The bundle works reliably in CADit's browser environment
  • No CDN resolution issues at runtime

Exports

  • Default (@cadit-app/image-extrude): Pre-bundled version for CADit/browser use
  • Unbundled (@cadit-app/image-extrude/unbundled): TypeScript-compiled modules for Node.js/CLI use

License

MIT