News for hackers. Stuff that matters.
Re:Thoughts on Image Processing in JavaScript? by ed on Friday August 31, 2007 @02:56AM (#48618)
Hey Ivan, JS is a seriously crippled language when it comes to doing low-level processing. Like others have mentioned, cropping and resizing are trivial; however, to do anything even slightly sophisticated I'd suggest looking into flash.

Flash 8's image API -- specifically the BitmapData class -- can provide some low-level access to an image buffer (however the image must be round-tripped from localhost to the server if you want to edit local images).

Alternatively, IE provides some proprietary image filters which can be used to process images (but obviously not in a cross-browser way).

Re:Thoughts on Image Processing in JavaScript? by ed on Friday August 31, 2007 @03:24AM (#48628)
Ok, to counter my bummer parent post here are some things you COULD feasibly implement in javascript:

- color tinting (overlay semi-transparent colored elements on an image)

- image cut-and-paste (like cropping, place some bounded area of an image in a div with hidden overflow [the copy] and allow that to then be placed over the original image [the paste])

- image gradients, drop shadows, reflections (but these have been done to death and are usually too sluggish to use in a production app)

- some neat UI tricks like scroll wheel zooming and gesture-based panning (mootools has some demos which show what's possible - demos.mootools.net)

- if you really wanted to kill yourself, you could use flash (degrade to a server-side script) to build a pixel by pixel representation of the image using floated divs and background colors. Then create a JS singleton with your desired methods to be the image buffer's API. Thus, you're granted pixel-level access to the image and could (slowly) do whatever sort of processing you desire in JS.

Re:Thoughts on Image Processing in JavaScript? by ivankirigin on Friday August 31, 2007 @10:30AM (#48714)
Wow. Those options are bleak. I'd certainly learn more JS in the process, but it wouldn't be reusable or scalable.