Fix Picture_Format_From_Data()

Check the result of memcmp() against 0. Extend the JPEG magic number.
Add a simple test.