Lately I had same crazy thoughts on coding a javascript wrapper to manipulate images rendered on the server-side. I decided to do some test which eventually resulted in phototype, a client/server-side library, based on prototype, which supports all kinds of image manipulations. On the serverside the library is powered by combination of PHP/GD that renders the image. With phototype, you are able to rotate, resize, flip and do some other cool effects to images. Let's start a quick tour.
Suppose we have a picture like this (randomly grabbed from Flickr):

First, let's reisize it:
- l_oPhoto = new Photo();
- l_oPhoto.resize({width:200});
- document.body.appendChild(l_oPhoto.fetch());

Pretty nifty eh? Note that the resizing is done serverside because usage of GD. Ok, let's do some flipping:
- l_oPhoto = new Photo();
- l_oPhoto.resize({width:200});
- l_oPhoto.flipV(); // Flip vertical, use flipH to flip horizontal
- document.body.appendChild(l_oImage.fetch());

And rotate it some degrees:
- l_oPhoto = new Photo();
- l_oPhoto.resize({width:200});
- l_oPhoto.flipV();
- l_oPhoto.rotate(3); // rotate 3 degrees
- document.body.appendChild(l_oPhoto.fetch());

Drop shadow and make sketchy..
- l_oPhoto = new Photo();
- l_oPhoto.resize({width:200});
- l_oPhoto.flipV();
- l_oPhoto.rotate(3);
- l_oPhoto.dropShadow();
- l_oPhoto.makeSketchy();
- document.body.appendChild(l_oPhoto.fetch());

Or, make it greyscale?:
- l_oPhoto = new Photo();
- l_oPhoto.resize({width:200});
- l_oPhoto.flipV();
- l_oPhoto.rotate(3);
- l_oPhoto.dropShadow();
- l_oPhoto.toGreyScale();
- document.body.appendChild(l_oPhoto.fetch());

Adding a caption:
- l_oPhoto = new Photo();
- l_oPhoto.resize({width:200});
- l_oPhoto.rotate(3);
- l_oPhoto.dropShadow();
- l_oPhoto.addCaption('Get ajaxorized!', '1942.ttf');
- document.body.appendChild(l_oPhoto.fetch());

And finally, because we can't live without Chuck Norris :-):
- l_oPhoto = new Photo();
- l_oPhoto.resize({width:200});
- l_oPhoto.rotate(3);
- l_oPhoto.dropShadow();
- l_oPhoto.addCaption('Cheers, Chuck', '1942.ttf');
- l_oPhoto.addChuckNorris(); // every library should have this function imo
- document.body.appendChild(l_oPhoto.fetch());

Chaining
Phototype supports chaining:
- l_oPhoto = new Photo().load("test.jpg").dropShadow().flipH().makeSketchy();
- document.body.appendChild(l_oPhoto.fetch());
That's it. I'm really looking forward to your comments, you can download the full package here, it's GPL licensed.