|
|
@ -1,7 +1,7 @@ |
|
|
|
#!/usr/bin/env python |
|
|
|
#!/usr/bin/env python |
|
|
|
|
|
|
|
|
|
|
|
import sys |
|
|
|
import sys |
|
|
|
import ascii_bin |
|
|
|
from methods import ascii_bin |
|
|
|
|
|
|
|
|
|
|
|
method_pointers = { |
|
|
|
method_pointers = { |
|
|
|
"ascii_bin": ascii_bin.generate |
|
|
|
"ascii_bin": ascii_bin.generate |
|
|
@ -18,6 +18,7 @@ def get_input(file:str, bytesize:int = 8) -> list: |
|
|
|
return [ f_str[i:i+bytesize] for i in range(0, len(f_str), bytesize) ] |
|
|
|
return [ f_str[i:i+bytesize] for i in range(0, len(f_str), bytesize) ] |
|
|
|
|
|
|
|
|
|
|
|
def generate_image(file:str, method:str = "ascii_bin", bytesize:int = 8) -> None: |
|
|
|
def generate_image(file:str, method:str = "ascii_bin", bytesize:int = 8) -> None: |
|
|
|
|
|
|
|
print("Formatting and converting input data...") |
|
|
|
inp = get_input(file, bytesize) |
|
|
|
inp = get_input(file, bytesize) |
|
|
|
|
|
|
|
|
|
|
|
method_pointers[method](inp) |
|
|
|
method_pointers[method](inp) |
|
|
@ -27,5 +28,5 @@ if __name__ == "__main__": |
|
|
|
try: |
|
|
|
try: |
|
|
|
generate_image(sys.argv[3], sys.argv[1], int(sys.argv[2])) |
|
|
|
generate_image(sys.argv[3], sys.argv[1], int(sys.argv[2])) |
|
|
|
except Exception as err: |
|
|
|
except Exception as err: |
|
|
|
print("\033[91m./generator.py (method:str) (bytesize:int) (dimensions:str (WxH)) (input_file:str)\033[0m") |
|
|
|
print("\033[91m./generator.py (method:str) (bytesize:int) (input_file:str)\033[0m") |
|
|
|
raise err |
|
|
|
raise err |
|
|
|