This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import argv | |
from math import sqrt, ceil | |
from struct import pack, unpack | |
from PIL import Image | |
def file_to_image(data, ext): | |
size = pack(">I", len(data)) | |
full_data = bytearray(ext + '\0', 'ascii') + size + data |