Use the ajax object to post the image to binary. Use the binary data object to send as a message.
For a photo, you can use the user media object for access to the camera, or nw.js for access to the local disk.
Haven't done any of this before myself so I don't have any specific examples for you, but the manual should have everything you need.