Feature: download selection as PNG#36
Conversation
|
This look really cool, nicely worked into the slightly inadequate build scripts too. Will give this a spin on the train home & merge it in. We'll be able to refactor most of canvas2image away, since it's only using a very small part of it. |
|
I've pulled this into a branch to hack on it - https://github.com/jakearchibald/sprite-cow/tree/feature/save-selection I'd like to look into ways to give it a proper file extension when it saves, the download attribute may help with this http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#attr-hyperlink-download |
|
Thanks Jake. Plus, I think the I'll take a look at other image-saving implementations, it might help. |
|
http://jsbin.com/ulobic/1/ - changing a link href on mousedown seems to work, 'click' may work too & be safer for different input types. Are there browsers that have a shorter a.href limit than location.href? The MDN page just suggests a hard limit on data uris. |
I needed this feature to split a sprite into multiple images. This commit adds a new button "Save selection" which allows to download the current sprite selection.
It relies on canvas2image and a new class
spritecow.RectSaver.