Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

image-stroke-v2

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-stroke-v2

Makes stroke for a image with transparent background.

  • 0.9.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

ImageStroke

Makes stroke for a image with transparent background.

Demo

Click here to see live demo.

Getting Started

Installing

yarn add image-stroke

How To Use

There are three built-in methods to make stroke. Choose one of them in different situations.

  • Rotate. Rotate the image with 360 degree.
  • Contour. Detects contours of the image by Marching Squares and get the paths, then stroke those paths.
  • Distance. Calculates the distance from each pixel to the edge of the image by Distance transform, and fills all pixels whose distance is less than the stroke width.
  • Rotate by WebGL. The same as 「Rotate」 but implements in WebGL.
import ImageStroke from 'image-stroke'

// Choose one of these methods
import rotate from 'image-stroke/lib/method-rotate'
import distance from 'image-stroke/lib/method-distance'
import contour from 'image-stroke/lib/method-contour'
import rotateByGL from 'image-stroke/lib/method-rotate-by-gl'

const imageStroke = new ImageStroke()

// Just use it
imageStroke.use(rotate)

const image = new Image();
image.onload = () => {
    // Get result
    const resultCanvas = imageStroke.make(image, {
        thickness: 10,
        color: 'red'
    })
}

Keywords

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc