Skip to content

Instantly share code, notes, and snippets.

@fy0
Created May 5, 2017 04:53
Show Gist options
  • Save fy0/7c9d725ab4aaf5eb36c6df54e0dfd5f0 to your computer and use it in GitHub Desktop.
Save fy0/7c9d725ab4aaf5eb36c6df54e0dfd5f0 to your computer and use it in GitHub Desktop.
import struct
from PIL import Image
fp = open('myshot.raw', 'rb')
size = struct.unpack('II', fp.read(8))
img = Image.frombytes('RGBA', size, fp.read())
img.save('out.bmp')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment