jspaint/README.md

189 lines
9.3 KiB
Markdown
Raw Normal View History

2014-05-30 07:00:01 +00:00
2018-06-29 04:22:50 +00:00
# [![](images/icons/32.png) JS Paint](https://jspaint.app)
2014-09-22 10:13:18 +00:00
2018-06-29 04:22:50 +00:00
A nice web-based MS Paint remake and more... [Try it out!](https://jspaint.app)
2015-10-19 19:11:10 +00:00
2017-01-12 05:02:17 +00:00
<!-- You can also run it as a desktop app... -->
2016-11-05 19:52:44 +00:00
2014-05-30 07:00:01 +00:00
The goal is to remake MS Paint
(including its [little-known features](#did-you-know)),
2015-02-24 00:39:43 +00:00
improve on it, and to [extend](#extended-editing) the types of images it can edit.
2014-10-28 23:09:27 +00:00
So far, it does this pretty well.
2018-06-13 02:37:33 +00:00
![Screenshot](images/meta/main-screenshot.png)
2015-02-24 00:39:43 +00:00
2015-10-19 19:11:10 +00:00
Ah yes, good old paint. Not the one with the [ribbons][]
or the [new skeuomorphic one][Fresh Paint] with the interface that can take up nearly half the screen.
2017-06-02 04:59:44 +00:00
And sorry, not the even newer [Paint 3D][].
[ribbons]: https://www.google.com/search?tbm=isch&q=MS+Paint+Windows+7+ribbons "Google Search: MS Paint Windows 7 ribbons"
[Fresh Paint]: https://www.google.com/search?tbm=isch&q=MS+Fresh+Paint "Google Search: MS Fresh Paint"
[Paint 3D]: https://www.microsoft.com/en-us/store/p/paint-3d-preview/9nblggh5fv99
2015-10-19 19:11:10 +00:00
Windows 95, 98, and XP were the golden years of paint.
You had a tool box and a color box, a foreground color and a background color,
and that was all you needed.
Things were simple.
But we want to undo more than three actions.
We want to edit transparent images.
We can't just keep using the old paint.
So that's why I'm making JS Paint.
I want to bring good old paint into the modern era.
2014-08-10 03:06:33 +00:00
2014-09-29 01:19:48 +00:00
#### Current improvements include:
2018-01-22 07:46:27 +00:00
* Cross-platform
2014-10-28 23:09:27 +00:00
* Unlimited undos/redos (as opposed to a measly 3 in Windows XP,
2018-01-22 07:46:27 +00:00
or a measly 50 in Windows 7)
* Autosaves if you allow local storage.
(Try refreshing the page to make sure this works, and to check it out)
* Edit transparent images! To create a transparent image,
go to Image > Attributes... and select Transparent,
2016-03-24 16:00:40 +00:00
then Okay, and then Image > Clear Image or use the Eraser tool.
2018-01-22 07:46:27 +00:00
Images with *any* transparent pixels will open in Transparent mode.
* Go to View > Extras Menu to enable access to additional features not available in MS Paint
2017-01-29 20:19:43 +00:00
* Switch themes from the Extras menu
2018-01-22 07:46:27 +00:00
* Create an animated GIF from the current document history.
Accessible from the Extras menu or with <kbd>Ctrl+Shift+G</kbd>.
It's pretty nifty, you should try it out!
You might want to limit the size of the image though.
* You can shoot at it [Asteroids style](https://kickassapp.com/)
2015-10-19 19:11:10 +00:00
* When you do Edit > Paste From... you can select transparent images and GIFs.
2015-02-24 00:39:43 +00:00
~~You can even paste a transparent animated GIF and then
hold <kbd>Shift</kbd> while dragging the selection to
2015-02-24 00:39:43 +00:00
smear it across the canvas *while it animates*!~~
Update: This was [due to not-to-spec behavior in Chrome.](https://christianheilmann.com/2014/04/16/browser-inconsistencies-animated-gif-and-drawimage/)
2015-02-24 00:39:43 +00:00
I may reimplement this in the future as I really liked this feature.
2018-01-22 07:46:27 +00:00
* You can open SVG files (because browsers support SVG).
It's still a completely raster image editor though.
* You can crop the image by making a selection while holding <kbd>Ctrl</kbd>
2014-12-08 02:45:23 +00:00
* Keyboard shortcuts for rotation: <kbd>Ctrl+.</kbd> and <kbd>Ctrl+,</kbd> (<kbd><</kbd>/<kbd>></kbd>)
2018-01-22 07:46:27 +00:00
* Rotate by any arbitrary angle in Image > Flip/Rotate
2015-10-13 18:56:42 +00:00
* In Image > Stretch/Skew, you can stretch more than 500% at once
2018-01-25 03:51:12 +00:00
* Replace a color in the entire image by holding <kbd>Shift</kbd> and using the fill tool (AKA non-contiguous fill)
2018-01-22 07:46:27 +00:00
* Rudimentary **multi-user** support.
Start up a session at
2018-06-09 18:51:14 +00:00
[jspaint.app/#session:multi-user-test](https://jspaint.app/#session:multi-user-test)
and send the link to your friends!
2018-01-22 07:46:27 +00:00
It isn't seamless; actions by other users interrupt what you're doing, and visa versa.
Sessions are not private, and you may lose your work at any time.
If you want better collaboration support, follow the development of [Mopaint](https://github.com/1j01/mopaint).
* Load many different palette formats with Colors > Get Colors.
(I made a [library](https://github.com/1j01/palette.js/) for this.)
2015-06-22 00:01:12 +00:00
* Mobile support
* Click/tap the selected colors area to swap the foreground and background colors
2018-06-13 02:37:33 +00:00
![JS Paint drawing of JS Paint on a phone](images/meta/mobipaint.png)
2014-05-30 07:00:01 +00:00
2014-09-29 01:19:48 +00:00
#### Possible improvements include:
2014-08-18 20:56:16 +00:00
* [Extended Editing](#extended-editing)
2014-09-29 21:12:32 +00:00
* Proportionally resize the selection or canvas by holding <kbd>Shift</kbd>
2017-06-02 04:59:44 +00:00
(or maybe that should be the default)
* After adding text, save as SVG or HTML with selectable text
2016-11-05 19:52:44 +00:00
(invisible text positioned over an embedded bitmap image)
* <kbd>Alt</kbd> as a shortcut for the eyedropper, as long as it doesn't conflict with keyboard navigation of menus
2015-10-14 02:36:25 +00:00
* Optional fill tolerance (slider that you enable from a settings menu?)
* Interactive tutorial(s)?
2014-09-22 10:13:18 +00:00
#### Limitations:
2014-09-22 10:13:18 +00:00
A lot of stuff isn't done yet.
[See: the big long todo list.](TODO.md)
2014-09-22 10:13:18 +00:00
Clipboard support is somewhat limited.
You can copy with <kbd>Ctrl+C</kbd>, cut with <kbd>Ctrl+X</kbd>, and paste with <kbd>Ctrl+V</kbd>,
2014-11-25 05:39:16 +00:00
but data copied from JS Paint can only be pasted into other instances of JS Paint.
2015-02-24 00:39:43 +00:00
There's apparently no way for web apps to properly copy image data to the clipboard.
2018-01-22 07:46:27 +00:00
"[Support programmatical copying of images to clipboard](https://bugs.chromium.org/p/chromium/issues/detail?id=150835)"
is currently the top starred issue of chromium.
2018-06-29 04:22:50 +00:00
<!-- TODO: To use the clipboard menu items, you need to install the native app. -->
2014-08-18 20:56:16 +00:00
2014-05-30 07:00:01 +00:00
## Extended Editing
2014-10-28 23:09:27 +00:00
I want to make JS Paint to be able to edit...
2014-08-10 03:06:33 +00:00
2016-03-24 16:00:40 +00:00
* Transparent [PNG][]s - Done!
2015-02-24 00:39:43 +00:00
Images that are partially transparent will automatically open in Transparent mode.
2016-03-24 16:00:40 +00:00
To enable transparency for an image, go to Image > Attributes or press <kbd>Ctrl+E</kbd>,
select Transparent, and hit Okay.
Then you'll want to remove some of the background.
You can use the Eraser tool a bit, then use the Color Picker to
2015-02-24 00:39:43 +00:00
pick up where you erased and then use the Fill tool to remove bigger areas.
2016-03-24 16:00:40 +00:00
* Animated [GIF][]s
2018-01-22 07:46:27 +00:00
(yes, that entails a fully featured (but simple) animation editor). -
Currently you can only make GIFs of the document *history*,
with <kbd>Ctrl+Shift+G</kbd> or from the Extras menu.
2016-03-24 16:00:40 +00:00
* Animated Transparent [APNG][]s
2014-11-25 05:39:16 +00:00
(better than GIFs, but with less support)
2016-03-24 16:00:40 +00:00
* Multi-size Icons ([ICO][] for windows and [ICNS][] for mac)
2014-11-25 05:39:16 +00:00
* [Scalable Vector Graphics][SVG] (kidding) -
Actually, it could always open SVG files in browsers that can handle SVGs,
and I've made it try not to save over the original SVG.
2015-10-14 02:36:25 +00:00
That's pretty decent SVG support for a 100% raster image editor.
2016-03-24 16:00:40 +00:00
* [Text files][TXT] (definitely just kidding maybe)
2018-01-22 07:46:27 +00:00
* Tesselating patterns, and textures on 3D models;
that might be a pipe dream, but [then again...](https://github.com/1j01/pipes)
2014-11-25 05:39:16 +00:00
2015-10-19 19:11:10 +00:00
[PNG]: https://en.wikipedia.org/wiki/Portable_Network_Graphics "Portable Network Graphics"
[GIF]: https://en.wikipedia.org/wiki/Graphics_Interchange_Format "Graphics Interchange Format"
[APNG]: https://en.wikipedia.org/wiki/APNG "Animated Portable Network Graphics"
[ICO]: https://en.wikipedia.org/wiki/ICO_(file_format) "Microsoft Icon Image format"
[ICNS]: https://en.wikipedia.org/wiki/Apple_Icon_Image_format "Apple Icon Image format"
[SVG]: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics "Scalable Vector Graphics"
[TXT]: https://en.wikipedia.org/wiki/Text_file "Text file"
2014-05-30 07:00:01 +00:00
2014-09-22 10:13:18 +00:00
2014-05-30 07:00:01 +00:00
## Did you know?
2014-08-10 03:06:33 +00:00
2014-10-28 23:09:27 +00:00
* You can drag the color box and tool box around if you grab them by the right place.
2015-02-24 00:39:43 +00:00
You can even drag them out into little windows.
2017-06-02 04:59:44 +00:00
You can dock the windows back to the side by double-clicking on their title bars.
2014-10-28 23:09:27 +00:00
* In addition to the left-click foreground color and the right-click background color,
2018-01-22 07:46:27 +00:00
there's a third color you can access by holding <kbd>Ctrl</kbd> while you draw.
2014-10-28 23:09:27 +00:00
It starts out with no color so you'll need to hold <kbd>Ctrl</kbd> and select a color first.
2018-01-22 07:46:27 +00:00
The fancy thing about this color slot is you can
2014-10-28 23:09:27 +00:00
press and release <kbd>Ctrl</kbd> to switch colors while drawing.
2018-01-22 07:46:27 +00:00
* You can apply image transformations like Flip/Rotate, Stretch/Skew or Invert (in the Image menu) either to the whole image or to a selection.
If you make a selection with the Select or Free-Form Select tool, the transformations apply to the selection.
2014-12-08 02:45:23 +00:00
* These Tips and Tricks from [a tutorial for MS Paint](https://www.albinoblacksheep.com/tutorial/mspaint)
2014-09-29 01:19:48 +00:00
also work in JS Paint if they have a checkmark:
2014-02-07 02:47:16 +00:00
2014-09-22 10:13:18 +00:00
* [x] Brush Scaling (<kbd>+</kbd> & <kbd>-</kbd> on the Numpad to adjust brush size)
* [x] "Custom Brushes" (hold <kbd>Shift</kbd> and drag the selection to smear it)
* [x] The 'Stamp' "Tool" (hold <kbd>Shift</kbd> and click the selection to stamp it)
* [x] Image Scaling (<kbd>+</kbd> & <kbd>-</kbd> on the Numpad to scale the selection by factors of 2)
2018-01-22 07:46:27 +00:00
* [x] Color Replacement (right mouse button with Eraser to selectively replace the foreground color with the background color)
2014-09-22 10:13:18 +00:00
* [ ] The Grid (<kbd>Ctrl+G</kbd> & Zoom to 6x+)
2018-01-22 07:46:27 +00:00
* [ ] Quick Undo (Pressing a second mouse button cancels the action you were performing.
I also made it redoable, in case you do it by accident! But [it broke at some point in Chrome.](https://github.com/1j01/jspaint/issues/9))
2015-06-15 23:50:31 +00:00
* [ ] Scroll Wheel Bug (Hmm, let's maybe not recreate this?)
2014-10-24 00:54:05 +00:00
2018-06-10 03:50:03 +00:00
## Development Setup
[Clone the repo.](https://help.github.com/articles/cloning-a-repository/)
There's currently no build step of any kind.
You just need an HTTP server.
[Live Server][] is nice (it auto reloads when you save changes),
and it's included in `package.json` so if you want you can do
`npm i` to install dependencies and `npm run dev` to run it.
Alternatively you can install it globally with `npm i -g live-server`
and run it with `live-server`.
[Live Server]: https://github.com/tapio/live-server