Assuming you have a single contact form which is generated on page load, you're going to need a javascript solution (which isn't something this plugin does).
Keep it simple - have a data attribute for each gallery item, when it is clicked, set the value in the contact form via javascript.
Hope that helps,
Chris