The source code my previous post about a clipboard image applet is now available here: PasteImageApplet.zip
The code lets you post images from your clipboard directly to the webserver to avoid the need to go through Photoshop or another image application.
When you compile your own applet using javac, you’ll need to sign it in order to be able to get access to the clipboard. (I have signed the applet contained in the zip and the certificate expires 6 months from July 19th, 2009, around January 19th, 2010).
If you find it useful or somebody else has already done this (and somebody surely has, but I didn’t have any luck finding it on Google), please write me in the comments.
Thanks.
- Lasse

Hello,
Awesome little applet. I saw your demo looks very cool. However when I tried it in Safari and Firefox on my Mac it said “Image Not Found” each time. I used the screengrab shortcust to get my image.
SHIFT-COMMAND-4 then SPACE then CONTROL-CLICK
I use this all the time in Mail and iChat and would like to get it working in Safari with my web site p8ste.com It looks like you are onto something with this.
Hi Terry,
That’s because it only saves the image to the desktop.
Try opening the picture in Preview, click Command+A, Command+C and then try using the applet again. Then it should work.
BR, Lasse
Hmmmm,
The procudeure you outlined does work correctly, but…
The CONTROL-CLICK does not save the image to the desktop. It stores the image in the clipboard. If I click w/o the CONTROL key it would save it to the desktop.
So it seems the applet likes the data it finds from a copy within preview, but it doesn;t like the data it finds from a screen grab copy.
Any ideas why. Could the message be more descriptive about the data it is finding in the clipboard?
Thanks,
Terry
Hello again,
I was able to get it working on everything except IE8 (GRRRRRRR!!!! can’t stand IE). I get something like this…
http://p8ste.com/7f
Also, one more bit of info that might be useful.
If I use preview and select all, then copy the paste works. If I take a screen grab from my clipboard, paste into TextEdit then copy from TextEdit it give the “Image Not Found” Error.
Hmm, that’s pretty weird. I also tried the CTRL-click one, and it didn’t work for me either.
Also, I don’t know why it’s not working in IE8, but maybe someone could figure that out?
Look good but I don’t understand this much…. where is the source for shoot.php? Also, why was the applet source changed from the original code as it should have done a similar thing (why was this bit was all commented out and also the bit about POSTing as multipart data
/*con.getOutputStream().write(((String)
“–”+boundary+”\r\n “+
“Content-Disposition: form-data; name=\”img\”; filename=\”filename\”\r\n”+
“Content-Type: image/jpeg\r\n “+
“Content-Transfer-Encoding: base64\r\n\r\n” +
Base64.encodeBytes(stream.toByteArray())).getBytes());*/
)
Running Windows IIS server and Firefox, I cannot get this to work. Probably a file permissions issue but I’m not sure how to resolve? Your demo works for me.
Ideas?
@Pete: The source is available in the link PasteImageApplet.zip. Regarding why the source was modified from the original: I was not able to compile it using javac and was not able to get it working before i modified it. Regarding the code piece commented out: I changed it to get it working with shoot.php.
@Travis: I have only tried it with Linux so I am not able to tell how to get it working on IIS – Sorry.
I have the same problem like Travis. I’m trying to get it running on IIS and Firefox. It doesn’t work !!! :-(( Ideas?
Is there any possibility that this thing can work with PNG images? I like this applet but It spits out JPEG images, which are lacking on quality. PNG images would be better. I don’t know much about applets, maybe you can come out with a PNG version?
If anybody has a solution for outputting the clipboard as PNG (as needed by @dcgamers), please let us know in the comments.
@lassebunk If you look at the sourc code, it shows that he is uing a JPEG encoder to create the JPEG. You could just as easily change the code to use the PNG encoder. If you wanted to take it even further, you could make it configurable via the UI, listing a set of radio buttons as inputs for which image format you desired, altering the interface to support those parameters.
I am not able to get the Applet to work in IE (7) with your demo (same error Terry got, line 15). I could have sworn it worked a few days ago when I first tested it. Could it be because the signature expired? It works fine in Firefox.
This is the best thing ever! Thank you :)
Internet Explorer 8 have been my most used browser this year, it is definitely stable and fast loading too. ~
Does anybody have a solution for the IE8 problem?
IE8 problem:
Don’t use Object tag, use Applet tag instead.
Like so:
<applet id=”paste-image” code=”PasteImageApplet.class” archive=”/orders/pasteImage.jar” height=”1″ width=”1″></applet>