I'd start by learning how to write custom tags in general, so that you get a feeling for how they work. A book Like Head First
Servlets & JSP can help with that, but there are lots of introductory articles out there on the web.
Note that a custom tags can help with generating the IMG tag in the web page, but the tag's SRC attribute still needs to point to an image (or a servlet that streams an image). JSPs can't be used to handle such binary content.