Improved image format detection

Detection is based on the first two bytes of the original file.
If it corresponds to the JPEG "first bytes" signature, it assumes that it's a JPEG.
Merge pull request #4 from mguillermin/guess-image-format

Improved image format detection