I did find where the problem lies. I would suggest that the code detect when the image has a site root relative link (e.g. /image/picture.jpg) and account for that both in the thumbnail creation and in the src code that is put out in the new image.
I suggest either it automatically detects site root relative links, or there is a checkbox in the GUI for forcing a site root relative link. The former would be a better solution as the creation of thumbnails should be possible with a site root relative link as well.