In Windows, GIF (and other) files are defined not only by their extensions but by certain leading and trailing bytes.
Searching the web (“GIYF”)* for the correct bytes to add to the beginning and end of a filetype, adding those bytes where needed, and then changing the file’s extension, would be enough to created a picture file out of the raw data!
Hope this helps…
*(“GIYF”) = “Google Is Your Friend.”