Here's a little script I wrote to extract a whole lot of .png files from a compiled sprite sheet.

The python script reads the .bin file as binary, finds the starting header of a .png file (89504E47) and the footer (49454E44AE426082) and separates it into individual images.

This may not be the worlds best or most useful script, but it saved me several hours of copy and paste.

import binascii
import re
import os

for directory, subdirectories, files in os.walk('.'):
    for file in files:

        if not file.endswith('.bin'):

        filenumber = 0

        with open(os.path.join(directory, file)) as f:

            hexaPattern = re.compile(

            for match in hexaPattern.findall(binascii.hexlify(

                with open('{}-{}.png'.format(file, filenumber), 'wb+') as f:

                filenumber += 1