You'd have to read the image as binary, calculate coordinates, deal with palettes, then reconstruct the image file.
MoveToEx(startoffilex+4,startoffiley+4);
LineTo(endoffilex-4,startoffiley+4);
LineTo(endoffilex-4,endoffiley-4);
LineTo(startoffilex+4,endoffiley-4);
LineTo(startoffilex+4,startoffiley+4);
That's to draw the frame. To get the bigger picture, just make a new bitmap with 8 pixels more width and height, and bitblt into the middle.
I could probably do it in a day, but I'm too lazy to, and he already said he made it output HTML.
Note that I was talking about Windows, not Linux or any other operating system.
And he doesn't have to make it CGI accessible. He can just use it to make the pictures with frames, and use <img> tags to place the framed pictures in.