You do realize that your program is single-threaded, right? It does each connection in order. You have the listen set to 5, so if you get more than 5 requests while you are servicing one, the extra ones will get dropped.
Your read of the image files is not optimal. Reading based on newlines is not efficient for a binary file. It will probably go faster if you get the file size and do a single read on it. Also, if you are on Windows, I am pretty sure you have to set binmode.
1. Read up on making this multi-threaded. Would it be better if I fork them? Never been down this path.
2. Figure out how to set binmode and do a lookup on the file size and do a single read.