Support image selection  (rebased #108)

This is the changes in PR #108, rebased onto the current master with some minor conflict resolutions.