Personally, I would think that you could handle it quite the same way as you would through the web application. It should be easy enough to create a form that passes off to a class/function behind the scenes that connects via HTTP to the application server and "pretends" to be a regular client...
As for how to grab the image from your local system, look at JSR 75, and if you have access to the API,
you should be able to write something very similar to the desktop application.
Good luck!