Reputation: 1844
Is it possible to dynamically create and modify images on a per pixel level in JavaScript (on client side)? Or has this to be done with server based languaged, such as PHP?
My use case is as follows:
When searching in the web I just found posts about using IE's filtering method, but didn't find anything about image editing functions in JavaScript.
Upvotes: 7
Views: 9690
Reputation: 2096
Also look at data URIs (though IE versions below 8 don't support them, unfortunately!)
Upvotes: 1
Reputation: 2588
You may want to check out Processing.js. John Resig of jQuery fame wrote it. It supports pixel processing, unfortunately only Firefox 3 can handle it sufficiently.
Upvotes: 2
Reputation: 2239
Local image manipulation in JavaScript should be possible - have a look at Defender of the Favicon. ;-) The question is how to get the original image from the file system into your page (I don't know of any other way than doing a HTTP upload to the server first).
Upvotes: 0
Reputation: 7
Try Allicorn's Image Retargetter - it sounds like that's what you're looking for.
Upvotes: 0
Reputation: 11909
You can imagine a set of JS tools that will allow the user to define what kind of transformation he wants to do, but the final work of transformation MUST be done on a server side. JS on the client side is unable to create a file, for security reason.
Upvotes: 0
Reputation: 6060
Some browsers support the canvas: http://developer.mozilla.org/En/Drawing_Graphics_with_Canvas
Upvotes: 8
Reputation: 1848
This has to be done on the server side. One thing you might look at doing is allowing all the editing to go on client side, and then in the end POST the final image (via AJAX) to the server to allow it to return it to you as the correct MIME type, and correctly packed.
Upvotes: 2