code: def from_image_to_file(img_path, file_path):
      
      img = Image.open(img_path)
      data = numpy.array(img)
      data = numpy.reshape(data, len(img.getdata()) * 3)
      to_remove = data[len(data) - 1]
      data = numpy.delete(data, xrange(len(data) - to_remove, len(data)))
      data.tofile(file_path)
docs: Expects images created by from_from_file_to_image