So I've made a program that converts images to ASCII art.
And this program lets you load several images at the same time into a "session" I've now written a function that saves the currecnt "sesssion" to a .txt file.
But now I also want a function that can load such a .txt file and recreate the session. By extracting the data saves in it and running the appropriate functions.
Here is an example of what such a text files could look like:
-=Image Information=-
Name: 1
Filename: slalom.jpg
Size (Width x Height): 728 x 485
Target Size (Width x Height): 50 x 20
Brightness: 1.0
Contrast: 1.0
-=Image Information=-
Name: 2
Filename: slalom.jpg
Size (Width x Height): 728 x 485
Target Size (Width x Height): 50 x 20
Brightness: 1.0
Contrast: 1.0
-=Image Information=-
Name: kjdshfkjadshfkjdsf
Filename: slalom.jpg
Size (Width x Height): 728 x 485
Target Size (Width x Height): 50 x 20
Brightness: 1.0
Contrast: 1.0
================
Current image: kjdshfkjadshfkjdsf
This is what I want the function to do:
current_image.append(ImageProcessor(slalom.jpg))
current_image[-1].set_alias(name) if Name: is different than Filename:
current_image[-1].set_img_width(width) if Target size is different from 50 x *
current_image[-1].set_brightness(brightness) if Brightness: is different from 1.0
current_image[-1].set_contrast(contrast) if Contrast: is different from 1.0
I am having toruble writing a program that extracts the info...