Is there a Javascript library for Paint-like applications using canvas? [closed]
Asked Answered
T

6

29

Is there a Javascript library which has built-in features for quickly creating a Paint-like web application using the canvas element?

EDIT: So, far, I have found Javascript libraries that allow easy animation of canvas elements -- such as Raphael JS -- and Javascript tutorials for creating simple Paint apps, but no robust libraries for Paint-like applications.

EDIT 2: I found a Javascript tutorial on a pretty nice looking Paint app using the canvas element. I'd still like to see what others have found.

Textbook answered 20/8, 2011 at 19:47 Comment(6)
Using this Fabric.js demo, click on "enter drawing mode" button in sidebar to draw on canvas. Is this what you're looking for?Donal
@Donal I have seen demo, penceil drawing is ok but circle and others are not similar to paint how can we do that?Hautbois
@Thirumalaimurugan creating your own brushes is easy — fabricjs.com/fabric-intro-part-4/#free_drawingDonal
@Donal Thanks but there is no full example code, please try to provide the full code which will help much for the beginners, and more over its giving for pencil only, I am expecting the drawing like Microsoft paint brush. Simply if I want to say I need to create a program like Microsoft paint using wonderful fabric.jsHautbois
@Thirumalaimurugan please file an issue on githubDonal
@Donal Just stumbled across this step by step tutorial on how to create one: codetheory.in/creating-a-paint-application-with-html5-canvas - what's more, it is easier than I though and the code is freeEjection
V
3

There is processingJS, but as it is port of the JAVA bassed processing you write your code in "javaish" processing language. But after all you could create what an paint like app. Another framework is fabricJS which is also really great to work with canvas.

Visceral answered 20/8, 2011 at 20:1 Comment(0)
B
19

Raphaël

Raphaël doesn't use Canvas. It uses SVG on browsers that support it or VML on Internet Explorer.

SVG

If you want an SVG solution designed specifically for drawing then take a look at:

See this demo.

Canvas

If you want to use Canvas but you need a retained mode rendering then see:

Update (February 2014)

  • ART, a retained mode vector drawing API - targets all three of HTML5 Canvas, SVG and VML (plus some code generation). Used by the Facebook team together with the React UI toolkit (see: react-art and the "art" branch of the react-page project on GitHub).
Busyness answered 25/1, 2013 at 14:44 Comment(0)
T
7

Literally Canvas fits this exact purpose: http://literallycanvas.com

"Literally Canvas is an extensible, open source (BSD-licensed), HTML5 drawing widget...You can use it to embed drawing boards in web pages."

Tonicity answered 16/8, 2015 at 2:20 Comment(3)
Looks like this product was initally started a year after I asked this question. Good to see more current solutions!Textbook
Project is no longer maintained.Domesticity
That's correct, I stopped maintaining it due to lack of community support.Tonicity
S
4

You can try Painterro. It can be used for pasting and processing screenshots, cropping, drawing primitives and text, rotating, resizing (changing resolution), scaling, drawing arrows, exporting with desired compression level, supports hotkeys

Live Demo

enter image description here

Painterro has a browser-script version and npm package

Could be easily integrated with any SPA like Vue/React, works well in electron/cordova,

Disclosure: I am a founder of Painterro

Sneakers answered 1/7, 2017 at 18:24 Comment(0)
V
3

There is processingJS, but as it is port of the JAVA bassed processing you write your code in "javaish" processing language. But after all you could create what an paint like app. Another framework is fabricJS which is also really great to work with canvas.

Visceral answered 20/8, 2011 at 20:1 Comment(0)
I
3

There is an npm package spainter. Click on Run code snippet bellow and go fullscreen

var p = new Painter(containerPainter);
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/index.css"/>
<div id="containerPainter"></div>

or via webpack (or any other loader):

npm i spainter lines-logger

in your js:

import Painter from 'spainter';
import 'spainter/index.sass'; // you can impor index.css if you don't have sass, ensure that you copy the fonts from the directory as well to production. Set `$FontelloPath: "../node_modules/spainter/font"`
import {LoggerFactory} from 'lines-logger';
const containerPainter = document.createElement('div');
document.body.appendChild(containerPainter);
const p = new Painter(containerPainter, {logger: new LoggerFactory().getLoggerColor('spainter', 'blue')});

Live Demo

Indomitability answered 17/8, 2018 at 11:35 Comment(0)
Z
0

I think the closest you'll get is to expand on what that tutorial has gone through.

It's hard to create "general purpose" paint-like functionality due to the wide range of requirements.

Zebadiah answered 20/8, 2011 at 20:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.