Sunday, March 16, 2008

Comments 10 comments

jsAscii - ASCII art from images with Javascript and Canvas


Here is a little thing that will take any picture on a page and convert it to sexy ASCII art.
It uses the <canvas> tag and the getImageData method to read pixel data, so support is limited to Firefox, the latest Opera 9.50 beta and WebKit nightlies (no IE), and even then Opera has problems rendering the ASCII art when small font sizes are used.

Note that if you try to run this code on your local desktop or on images from a foreign host, you'll get a security error. This will only work from a website and only on images on that host.

Demos, example code and download link at: http://www.nihilogic.dk/labs/jsascii/


10 comments:

It doesn't work in Safari 3.0

Apart from that, it's fantastic when tested out on FF...

Well Done

Yea, it appears that Safari lacks the getImageData() method.
Thanks!

No problem with my safari ( Version 3.1 (5525.13) )
getImageData works perfectly!

Very nice technique!!

Huge props on this. I love it.

it's a really good script - but you should use 'monospace' instead of 'courier new' as font, so that it also is displayed correctly on systems without courier new font

Doesn't work in my Firefox 3. I tried everything, I don't see what I'm not doing correctly.

Jacob, it seems like Firefox 3 isn't allowing line 53 of jsascii.js

Error: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "file:///C:/Documents%20and%20Settings/Victor/Desktop/jsascii.js Line: 53"]

@victor: It looks like you're running it from your desktop. Firefox will throw a security error when running on local files or files from another host. If you upload it to your webhost, it should work just fine.

I understand. Thanks.

This is amazing.. great work here..

Post a Comment

 
Copyright 2008-2009 Jacob Seidelin - Privacy Policy - Some icons by Bruno Maia, IconTexto