First you have a better chance of being struck by lightning than getting hit by one of those, they do exist but are rare, A jpeg file has code in it like any other file, Hackers use a buffer overflow within the code of the file to execute malitious code.