Where will the executable be? In the web server? Or in the end-user's computer?
If on the server, then your web page should be able to tell if the button was pressed, and then spawn your C++ executable file in the server side passing say, the file name of the image as part of the command-line arguments. This should be easy enough for pages in PHP, ASP, or ASP.net.
If on the end-user's computer, then things get complex really fast. Most (if not all) browsers will stop a web page from spawning an executable in the end-user's computer due to security reasons. You'll have to play along the rules of the browsers to get it to work.
In Windows, Internet Explorer would allow the web page to run your executable through an ActiveX component that is marked as Safe for Scripting. There are two ways to mark and ActiveX component as such: 1. Through the windows registry, or 2. The ActiveX component implements IObjectSafety. I have done neither, so I don't think I can help with these.
I don't know the rules of Firefox, if any, and much less other web browsers or browsers in Unix/Linux or Mac.
Here's a quick link:
http://msdn.microsoft.com/en-us/library/aa751977%28VS.85%29.aspx
Since this is a C++ forum, you might be better off asking elsewhere.