diff --git a/.gitignore b/.gitignore index b06aaa1..0942646 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.py[cod] documentation/ +*.jpg diff --git a/generator.py b/generator.py index 653dfde..8c224f3 100755 --- a/generator.py +++ b/generator.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -import ascii_bin +from methods import ascii_bin method_pointers = { "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) ] def generate_image(file:str, method:str = "ascii_bin", bytesize:int = 8) -> None: + print("Formatting and converting input data...") inp = get_input(file, bytesize) method_pointers[method](inp) @@ -27,5 +28,5 @@ if __name__ == "__main__": try: generate_image(sys.argv[3], sys.argv[1], int(sys.argv[2])) 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 diff --git a/ascii_bin.py b/methods/ascii_bin.py similarity index 69% rename from ascii_bin.py rename to methods/ascii_bin.py index 5f79023..9689b51 100644 --- a/ascii_bin.py +++ b/methods/ascii_bin.py @@ -3,8 +3,8 @@ import scipy.misc as smp from PIL import Image -bit_on = [255, 255, 255] # RGB value if bit is 1 -bit_off = [0, 0, 0] # RGB value if bit is 0 +bit_on = [191, 191, 191] # RGB value if bit is 1 +bit_off = [17, 16, 21] # RGB value if bit is 0 def translate_bit_color(bit:str): if( bit == "1" ): @@ -19,7 +19,10 @@ def data_to_matrix(data:list) -> np.array: return col_array def generate(inp:list) -> None: + print("Converting data to matrix...") col_array = data_to_matrix(inp) + print("Generating image...") img = Image.fromarray(col_array, "RGB") img.save("ascii_bin-image.jpg") + print("Generated image \"ascii_bin-image.jpg\"")