You probably need the setContentType set correctly (as you currently do).
However, have you tried using a different format, like PNG (and of course, use "image/png" as content type)? I'm not sure Java 1.5 has a GIF writer, due to the LZW licensing issues of the past. Note that the ImageIO.write methods have a boolean return type, to check if anything was written. In any case, PNG should always work.
PS: Unless you are planning to modify the image in the servlet, it is of course much faster to store the image in the right format in the blob, and just passing it down to the client without decoding/encoding it.