Socket
Socket
Sign inDemoInstall

image-sketchpad

Package Overview
Dependencies
10
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    image-sketchpad

Draw on images within desktop and mobile browsers.


Version published
Weekly downloads
8
increased by33.33%
Maintainers
1
Install size
923 kB
Created
Weekly downloads
 

Changelog

Source

1.1.0 (2022-03-02)

Full Changelog

Readme

Source

Image Sketchpad (responsive)

preview

Draw on any image inside your desktop or mobile browser.

  • Get image with drawing as base64 string or download it directly (original or browser sized)
  • Get sketches as JSON data
    • Load the sketches by the JSON
    • Load by method or data-sketchpad-json attribute
  • Set options like line width or color
  • Responsive: draw on the image and resize the browser. If the image resizes your sketch will do too. Also JSON data considered the image ratio so you can draw on a tiny image version (css resized!) and load the JSON data on a bigger version of the image.

  1. Demo
  2. Install
  3. Usage
    1. Browser: VanillaJS
  4. Documentation
    1. Sketchpad Options
    2. Sketchpad Methods after init
  5. ToDo

Demo

You can try a working example online: DEMO

Install

npm install image-sketchpad --save

# yarn add image-sketchpad

Usage

I have included different files for different usages

Browser: VanillaJS

First include the JS file at the bottom of your html page

    <script src="image-sketchpad.min.js"></script>
  </body>
</html>

Second initialize the sketchpad and bind it to an image

    <img src="..." id="Image" />

    <script src="image-sketchpad.min.js"></script>
    <script>
        var img = document.getElementById('Image');
        var sketchpadOptions = {};
        var sketchPad = ImageSketchpad(img, sketchpadOptions);
    </script>
  </body>
</html>

That's it!

Documentation

Sketchpad Options

Available Options

Sketchpad Methods after init

Methods

ToDo

  • Test with some kind like electron
  • Write e2e tests

Inspired by

responsive-sketchpad - I made a complete rewrite but got the inspiration from this nice npm package.

Keywords

FAQs

Last updated on 02 Mar 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc