How to turn TXT ASCII to PNG Python

Question:

I have been trying to solve this problem I have right now. I have tried many many ways to convert txt files to pngs but none has worked for me.

I have been wanting to convert the text file below (the content of this file is pasted below) to a png file that I would like to practically be a screenshot of the text file, but not literally a screenshot, so that I could have a png image of the ASCII text.

(StackOverflow makes the text paste look very wonky, but if you copy and paste it all into txt file you will see the ascii art.)

***???%%%%%%%%%%%%%%%%%??*****??%%%%$#####$%%%%#########$$$$$$$$$$$$$$$$$$$$$$$#$$$$#$$$$$$$$$$%%$$$$$$$$$$$$%?*%$$$$$$$$$$$$$$$$$$####$$#$#########??;::::;+%%$$$$$$$$%?%%%%%%%$$$$%%%%%%%????%??????%?%%%%%%%%%%*+%%%%%%%%?++++++*++++**%%%$#$$$%%?%$$$$$$$$%%%%$$$$$%%%%%%%$$$$$%%%%%%?%%%%?????????***??
??%%%%%%%%%%%%%%%%%$$%?????????%%$$$$$$$$$#$%%%%%$$#$$##$##############################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$$$$$#####################$?+;;;;;??$##$$$$%$$$$######$$??**????***??%%%%%$%%$%%%$$$%%%$**$########$$$$$$$$$$$%%%%%%%%$%??%%%$$$$$$$%?%$%%%$$$$%%%%%%%%%%%$$$%%%%%%????????%?***??
%%%%%%%%%%%%%%%%$$$%%%%%%%%%%%$###$$########%?????$##$#################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$##########################$*+;++?$###$$$#$%$$$$$$######$%%??????**?%$$$%$$$%%$$%%$$$$$$+?$$$##############$$##$#$$$$%%$$$$$$#$%%$$$?**?%$%%%$$$$$$%%%%%%%%%%%%%%%%%%%?%???%??????
%%%%%%%%%%%%%$$$%%%%?%%?????%$#$$$$$#########?*****?$##$##################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#########################$#$$$$##$#$$$###@@@@@@##$$##$$$$$$$$$%?????????%%$%$$$$$$$$$$+%#$$##########$%%$$$%$$$#$$$$$%$$$####%???%***???%%%$%%%%$$$$%%%%%%%%%%??%%%%%%%%?%??????
%%%%%%%%%%%$$%??????????????$#$$$$$%$########$*******%###$$################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#########################$$##$$$$$$$###@@@@@@@@####$$$$$$$$$$$$$%%??******???%%$$%%$$%+%$$##########$%?***%$$$$######$$#$$####%?%%**??????%$$%%%%%%$$$$%%%%%%%%??%??????%%??????
%??%%%%?%$$%?******??**????$##$$$$$$##########$???????%$###$################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$##########################$$?$$$######@@@@@@@@############$$$$$$$$$#$$$%?***??**???%??%?+%$$$$$$##$$#%?*+*;+$$$$$$$$$$$$$$$$$$$$#$$??**???**???%%%%%%%%%%%$$%%%%%%%%???????%??????
%%%%%%%$$%????????????????%##$$$###$###########$????????%###############################$$#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$##################$$$$$##$%######$$#############$$$#####$$##$$$$##$$$$?***????%$$$$$?+$$$%%%%$%$$$%$%%%%%%%%%%%%%%%%%%%%%%%%%$%?%$%?**????**??%$%%%%%%%%%%%%%%%%%??????%%???**?
%%%%$$$%????????%%????%%%%##$$$$$$$$############%????????%$############################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$################$$$##############$$$$$######$$#$$$$$$$$%%??$$$####$%????????%$$$$$$##?*$$$$$$$$$#$$$$$%%%%%%%%%%%%%%%%%#$$%$$%??%$$$$?**?%??*?**?%%$%%%%%%%%%%%%%%%?????%%?????*
%%$$$%%%%%%%%%%%%%%%%%??%$$$$$$$$$$$#############$%%%%%%%%%$#############################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$###########$$$$$###############$$$$$$#$$$$$##$$$$$$#$$%%?%$$$$$%?*****???%$#########*?$$$$$$$##$%%%%%%%%%%%%%%%%%%???%$%??*??%%$$$$$%%??**???*****?%%%%%%%%%%?%%%%%%%??%??????*
##$%%%%%%%%%%%%%%%%%???**?%%%$$$$$$$##############$%$$$%%%%%$$###########################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$########$$$###########$$$$$$$$$%$####$$$$$$$$$$$$$$$%%%$#$%?%%??****?$$#$$$$$#####$+?$$$$$##$%%%%%%%%%%%%%%%%%%%$#$$%*+****************+++**++*++++*******%%??????%%%%%%?????*
$%%%%%%%%%%%%%%%%??%%%$$$$#$###$$$#################$%%$%%%%%%%$#########################$$$$$$$$$$$$$$$%%%%%$$$$$$$$$$$$$$$$$$#####################%%$###$$$#$%$########$$$$$$$$$$$$%%%?*??%%???%$#############$$+%#$$$##$%%%%%%%%%%%%%%%%$%%$#@$%*?*+*++*+*++*++*++++*?*+*+++++++++****?%?????%????%%%????*
%%%%%%%%%%%%%%????%%%%$##########$##################$%$$$%%$%$$$$#######################$$$$$$$$$$$$$$%%%*+*%%$$$$$$$$$$$$$$$$#######################$$$$$$$$####################$%%???????%%$$#############$$$$%+$$$$##$%%%%%%%%%%%%%%%%%%%$$#@$**?;;+;+*;*;;;;++;+;++?;+++;+++;;;+;+*?*?%????%????%??????*
%%%%%%%%%%%%%%%%%%%%%$####$$$$$$$$$$#################$$%%%%%%%%%%%$######################$$$$$$$$$$$$%%%?+++*%$$$$$$$$$$$$$$$$######################################@@#@@@@###$%%???????*?%$###############$$$$$?+$$$##%%%%%%%%%%%%%%%%%%%%%$$#@$*??;;;;++;;;;++*++++*+*+*+*+*++*+++;;*?**%%%??%???%%???????
%%%%%%%%%%%%%%%%%%%%%####$$$$$$$$$$$#################$%%%%%%%%%%%%%$#####################$$$$$$$$$$$$%%%?*+???%$$$$$$$$$$$$$$$#########################################@##$%%%?????????%$$################$$$$$$?*$$#$%%%%%%%%%%%%%%%%%$$%$$$$#@#%*?+;+;+++++*+;+***;;*?+;+*+*;;+;++++**+*???%%????%?????***
%%%%%%%%%%%%%%%%%%%%####$$$$$$$$$$$$##################$%%%%%%%%%%%%%%$###################$$$$$$$$$$$$%%%**++*%%%$$$$$$$$$$$$$$#########################################$%???????????%$$###############$$$$$$$$$$*?##$%%%%%%%%%%%%%%%%%%%%%%%%$#@#$?************************************+**?***?%%?%%?????***
%%%%%%%%?????????%%#####$$$$$$$$$$$$###################$%%%%%%%%%%%%%%%$##################$$$$$$$$$$%%%%?;;;*%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%???????%?????%$################$%%%%%%%%%%%+%#$%%%%%%%%%%%%%%%%%%%%%%%%%%$@#%%%%%%%%%%%%%%%?*?*%%%%%??%?***+++*??**********?%%%?????***
?????????????%%%%%$###$$$$$$$$$$$$$####################$%%%%%%%%%%%%%%%%%$$$$$$$$$%%%%%%%%%??????????????***?????????%???%%%%?%%%%%%%%?????%%?????????%????????????????????????%$#################$%%%????%%%%$%+$%%%??????%%%%%%%%%%%%%%%%%$$###$%$$$$$%%%$$$%**???%$$%%%%%%%?**++**????*********%%?????***
%?%%%%%%%%%%%%%%%$###$$$$$$$$$$$$$$$####################$%%%%%%%%%%%%%%%%%%%%%%%%%?%??????******?????????*****?????????%%%%%%%%%%%%%%????%%?????????????????????%?????????%%%$########@@########$$%%%%%%%%??%$#?*$$%%%%%%??%%?????%%%%%%%%%%%$$##$%$$$$$$%%%%**?%$?%%%%$%%%%%%$?*++****???*******%%**?????**
%%%%%%%%%%%%%%%%$####$$$$$$$$$$%%%%$####################$$%%%%%%%%%%%%%%%%%%%%%%%???????????????????????*****?????%%%%%%%%%%%$$%%%%%%%%$$$%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$###########@@#######$$%%%%%%%%%%%%$##+%###$%?????%%%%%%%%%???????%%%$##$%%$%%$$%*+;?%%$$$%%%%%$%%%%%$$%***++***?%?****?%*****???**
??????????%%%%?%#####$$$$$$%%%%%%%%%#####################$$%%%%%$%$$%$$$$$$$$$$$%%%%%%%%%%$$$$$$$$$$$$%%%%%%%%$$$$$$$$$################################################@#######@@@@@@@@#####$$$%%%%%%%%%%%$$$$%+$#####%??%%%??%%%%%%%%%%%%%%%%$##$%%$%%%*;+*%$$%%%$$%$$;*$$%%%%%%%?*++*+***???**%?****+**??*
??????????????%#####$$$$$$%%%%%%%%%$###############################################################$$%%%?%%??%$%%?%$%$###########@@@###@@@@@@####@####@@###########@@##$%%#@@@@@@@@@@@@####$$$$%%%%%%%%%%$$#$%**#######$%%%%???%????%%%%%%%%%%$##$%%$%?;;?$$%%$$%%%$$$#%??%$%%%%%%%%?*+******??%%****++*****
?????????????%$####$$$$$$$$%%%%%%%%$###############################################################$%%?%??????$$%%$$%$#######@@#@@@@@##@@@@@####@@@#################$%?%$$@@@@@@@@@@@@@##$$$%%%%%%%%%%%%$$$$%?+*######$$%????????%%?%%??%%%%%%$$?$%%?+:+%$$%%%$$$%??%$?%?**$$%%%%%%$%?***?*++*%%?*****++****
????????????%$####$$$$$$$$$$$$$$$$$$#$$###############################################################$$%??%$$$##################@@################################$%%%$##@@@@@@@@@@####$$%%%%%%%%%%%%$$$$%???+*%#######%???????????????%%%%%%$%*??+;*?%%%$$%%%?%$$$%$***++%$$%%%%%%%%%?**++*?%**?**********
???????????%$####$$$$$$$$$$$$$$$$$$$##################################################################$%?*$########################@@@@#@@@@#@@@####@@@@@@@@@@@@@@@#$*+###############$%%%%%%%%%%%%%%$$#$%%??*;??%#######$$%?????????????????%%$?+;+?$%?%%$%%??%$$$##$$#?*?%$$###$%%%%%%?***%%*++*??********
*****?????%$####$$$$$$$$$$$$$$$$$$%%$################################################################$$??$@################@###################################$$$$#$**###########$$$$%%%%%%%??%%%%$$#$$%???%*+???%$########$?????****????????%#%*?%%%$?$#$%?%$$$$$#$###@#$$@@###$$%%%?%%?*%%**++***?*******
?????????%%####$$$$$$$$$$$$$$$%%%%%%%$$$########$$$$$$$$$$$$$$##############$$$$#$$$$$$$$$$$$$$$$$$$#$*+%@$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%$#$%###$$$$$#####$$%%$%%%%%%%$$#$$$%??????+*????%$#########%?*??????????????#$*%%%%$#$$?$$#$$%?%##$$$#$$#$$$$%??**????%$%**+******?******
????????%%$####$$$$$$%%%%%%%%%$$$$%%%%%%$$$$$$$$$$$$$$$%%%%$$$$$$$$$$$$$$$%%%%%%%%????????%$$$$$%%%%##$$##$%%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$#$$%%#$$$###$####$$$$$$#####$$%%????????*;**?????%$$########%???????????%%%##$$%%%###**#$$#$???%##$$#$%?$#$$%****+*?$$%%**********?*****
????????%%#####$%%%%%%%%%$$$$$$$$$$$$$$$$$$$%$$$$$$$%%$%??%%%%%$$$$$$$$$$$%%%%%%???????%%%%$$$$$%%%%%$$$$%%%%%%$$$$$$$$$$$$$$$$$$$#$$$#$#$$#$$$$######$$$######$$$$####$%$#######@@@#$$$$$$$%%%%%%%?????????*+??*???**??$########$??????????%%%###$%%%$;?%+$##$##??%??$$$#$%$#$%#%*++++*%%??%*********?*****
???%%%??%%%#####$$%%%%%$$$$$$$$$%$$$%%$%$%%%%$$$$$$$$$$$%??%%$$$$$$$$$$$$$$%%%%%%%%%%$$$$$$$$$$$#$####################################$$$$$$$$$$$$$$$$#$$####$?$########%%%%%%%%####$?%%%%%%%%%%%%%%%???????++?????????*?#########$%???????%%%%$##$%%%$%%%?$###$$#$*?$#$%$$####$#@%*++++*????%********??****
?????????%%%$$######$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#$$###$$$$$#$$$$##$$##$$$$$$$$$$$$$$$$$$$$$$$$$%$$$%$%%$$%%%%%$%$$$$$$$$#$$$$$$$?%$##$%??%##$%%%%%%%####$%%%%%%%%%%%???????%????+*???????????$########$%?????????%%$##$%%$%%$??%$$@#$$#%%#$$$%?%$#$%%##%*++**?????%?*******?****
??????????%%%%%%$$$$$$$$########$$$$$$$$$#$$$$$$$$$$$$$$$$$$$$$%$$%%%%$$%%%%$$$%%%%%%%%%%%%%%%%$$%%%%%%%%%%$$%%%%%%$$%%%%%%%%%%%$$$$$%%%$$$$$$$$%$$$$$%%$$%*%###$*;:;;;?$%%%%%%%###$%%%%%%%%%%%%%%?????%%%%?+?????????????$######$?***??*????%%$#$$???**$%?%#%$$#$$#$?$$%?;*#$?*%###%?**?%%?????******??**?*
????????%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$$%%%%%%%%%%%%%%$%%%%%%%%%%%%%%%%%%$%%%%%%%%%$%%%%%%%$$%%%%%%%%%%%%%%%%$%%%%%$###$$%*;%$$%%$$$$?%##@#?;:;%%;;?%%%%%%%%$%???%%%%%%%%%%%???????%%%*+??%???????????$######$?**????????%##$$$$***?%$$$#$?**$$$$**++;*$$$*?$###%?%$$%???%%***?**?????*
????%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%????????%%%%%$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$%%%%%%%%$%%%%%%%%$$%%%%%%%%%%%%%$####$$%%#@@##$%?%%%?%%?$%$$%####%++??##?:+%%%%%%%?%%%???%%%%%%%%????%%%%%???+*%%%%%%%????????$######$??????????$##$$%%*?%%%##$#$$$%%%%%%+++*%%$%%%%%$$$$$$%?%%%?%?*??*??%??**
%%%%%%%%%%%%%%%%%%%%%%?%%%%%%%%%%%%%%%???????????%%%%%$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$$%%%%%%%%%%%%%%%%%$$%%%%%%%%%%%%%#####@@@#$%%$%$$$$$$%+***$%%?$#$##%+?#%?#+,;%$%%%%%%%%%%???%%%%%%%????%%%%%%%*;?%%??%%%%%%%%???%$###$$$?%%%%?%??%####%?%%$$$####$$####$???*++?$%%$%%%%%%$$%%%%%%??%???**?%%??**
%%%%%%%%%%%%%%%%%%%???%%%%?????%%%%???????????%%%%%$$%%%%%%%%%%%%%%%%%%%%%%%???%%%%%%%%%%%$$%$%%%%%%%%%%%$$%%%$$$$$$$%%%%%%%$#$%??$@@@@@$?%$$%$%%%+*+?$$%;?%%$$?*;++?%?;;?$%%%%%%%%%%?%???%%%%%%%%??????%%*+?%%?????%%%%%%%%??%###%%???%??%?%$###$???$$####$%%$#@@##$??++*%#$%$$%%%%%??%%%%????%?*??%%%%??**
%%%%%%???%%%%%%%%%?????%%%%%%%%%????????????%%%%$$$%%%%%%%%%%%%????%%%%%%%%%%%%%%$%%%%%%$$$%$%%%%%$$$%%$$$%%%%$$$$%%%%%%%%%%$%+:;;;%@@@@@#%$%%%?$%++*?$$$%%%$$$??;:;*?%$*%#%%%%%%%%???%%???%%%%%$%%%%%????;*???????%%%%%%%%%%%%$##%%%%%???%$$$$#$%???%$%%%%%?**?$%$$$$%*?%%$$%%$%%%%???%%?????%?*??%%%%??***
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%??????%%%%%%$$%%$$%%%%??%%%%%%%%%?%%%%%%%%%%%%%%%%%%$$$%%%%%%%%%$%%$$$$%%%%%%$$%%%%%%%%%%%;:+%$:*#@@@@##%;%?%$%*+**%$$%%$$$#?*?++%%%??$#%???%%%%%%%%%%?????%%%%$%%??%%++???????????%%%%%%%%%?%$%%%%%%%%$#$$#$%?%??%%?%$%?*+++*?%#$%%%$%$$%%%$%%%%???%?????%%??%$%%%%??***
%%%%%%%%%%%%%%%%%%%%%%%??%%%%%%%??????%%%%%%%$$%%%$$%%%?%?%%%%%%%%%%???%%%%%%%%%%%%%%%$$%%%%%%%%$$%%$$$$$%%%%%%%$$%%%%%%%%%%+;%?#?:+$@###%%?*%%$$$?++*?%??$#$##%*+**????%$#%%%%%%%%%%%%%%%?????%%%%%%%???;*%%%%%%%%%?????%%%%%%%???%%$$$$#####$%%%%%%$%??$$?*+;++*%#?%%$$$$$%%%$%%%%???%?????%?%$$$%%%%???**
%%%%%%?%%%%%%%%%%%%%????%%%%%????%%%%%%%$$$$$%%%%%%%%%???%%%%%%%%%%??%%%%%%%%%%%%%%%$#%%%%%%%%%%%%%$$$$$%%%$%%%$$%%%%%%%%%$%+?%?%+:*$@@@@@#$%?%%$$?++**??%##$$$$%*++*+*?$#$$%%%%%%%%%%%%%%%????%%%???%$%*+?%%%%%%%%%%%%????????%%%%%%$######$%%%%%%%%%%?;%$%?*+;++?%?%?%%%*?%%%%%%%??????????%$$$$%%%%%??***
%%%%%%%%%%%%%%%%%%%??%%%%%%?????%%%%%$$$$$$%%%$$%%%%??????%%%%%%%%%%%%%%%?%%%%%%%%%$$%%%%%%%%%%%%%$$$$%%%%$$$$$%%%%%%%??%$#%+::*%$*?$@@@@@####$???******?$$%%%%$$%?***?$#$%$%%%%%%%%%%%%%%%%?????%%?%???+?%%%%%%%%%%%%%%%%%%%%%%$$########$%%%%%%?%$%%?%+:*%$?**+**%%$?%?#%++?%%%%????%?????%%$$%%%%%%%??***
??%%%%%%%%%%%%%%%??%%%%%?????%%%%%%%%$$$$%%%$$$$%%%%%%????????%%%%%%%%%%%%%%%%%%%%$$%$$%%%%$$$%%%%$%%%%%%$$$$$%%%%%%%%%$?%#%*;+%?%*%#@@@#%%%%%%%??*****?%?%%%%%$##$$$$##%%%$$%%%%%%%%%%%%%%%%%??%%%%???++%%%%%%%%%%%%%%%%$$$$$#########$%%%%%%%%%$%%?%?+++;?$$*?*?%$$$$#%?#%+*?%%%%%%%%%%%%%%%%%%%%%%%???**+
???%%%%%%%%%%%%%%%%%%?????%%%%%%%%%$$$%%%%%%%%%%%%%%%%??????????%%%%%%%%%%%%%%%%$$%%%%%%%$$$$%%%%$$$$$$$$$$%%%%%%%%%%%%%?*$%***?***$@@##%???%%%%%$$$$$$$$$$$%?%$$%%%$%?**%%?$$$$%%%%%%%%%%%$%%%%%%%%%??;*??%$%%%%%$$$$$#############$$%%%%%%%%%$$$%%%$%%$%*+%$??$%$$$$%*??$#?*%$$$$$$$$$$$%%%%%%%%%%%%???**+
%%%%%%%%%%%%%%%%%???????%%%%%%%%%$$$%%%%%%$%%%%%%%%%%%%%%?????%%%%%%%%%%%%%%%%$$$%%$%%%%%%$%%%%%%$$$$$$$$$$%%%%%%%%%%%%?**?$?++++*%####$$$$$$$%%%???*??**???*+*?*++;++++*%%?%$$$$$$%%%%%%%%%%%%%%%%%%%*+%%$$$##################$$$%%%%%%%%$%%$%%%%%%$##@@#$##$%%#$??%%%?+%$$$%###########$$$%%%%%%%%%%??****
%%%%%%%%%%%%%%????????%%%%%%%%$$$$$%%%%$$$$%%%%%$$%%%%%%%????%%%%%%%%%%%%%%%$$$$%$$$$%%%%$$%%%%$$%$$$$$$$$$%%%%%%%%%%%%*?%$$$%???$##%??***************????????%*;+;;+*+*?%%%%$$$$$$$%%$$$$$$$$$$$$###$+%################$$$$%%%%%%%%%%%%$$$%%%%%%%%%$$$%%$$$#@#$?**%??%%%%??##@@@@#@@@@@@###$$$%%%%%%%??****
%%%%%%$%%%%%%%????%%%%%%%%%%$$$%%$$$$%%%%%%%$%%%$%%%%$%%%%%%%%%%%%%%%%%%%%%%%#$%$$$$$$$%%$$%%%%$$$$$$$$$$$$%$$$%%%%%%%%?%??%$%$$$$?*?%%?%????????????%%%%%%%%$%*%#%$%*$##############################?*#######$$$$$$%%%%%%%%%%%%%%%%$$$$%%%%%%%%%%%$$%%%?+*?%$$%%$$??%%$?*+?#@@@@@#@@@@@@@@##$$$%%%%%%??***+
%%%%%$%%??%%%%%%%%%%%%%%%%$$$%%$$$$$$%%%%%$$$%%%$%%%$%%%%%%%%%%%%%%%%%%%%%%$#$$$$$$$$$$%$$$%%$%%$$$$$$$$$$$$$$$$$$$$$$$%?%$$$*++++;+#@$%%%%%%?%$$######@###@@#?%@$$#@*?@#########################$$$%+?$%$$%%%%%%%%%%%%%%%%%$$$$$%%%%%%%%%%%%%$$$%%%%??$$?;+*?$%%%%%$$%**+**$@@@@@#@@@@@@@@@@##$$%%%%%??**++
%%%%%%%%%%%%%%%%%%%%%%%%$$$%%$$$$$$$$$%%%$$$$$$$$$$$$$$%%%%%%%$%%%$$%%%%$$##$$$$$$$$$$$$$$$$$$$$#######################$##$%%?;??*?%$#@@@@@@@#$$%$######$####$*$$$%#@$*##$$$$$###$$$%%%%$$$$%%%%%%%?++%%%%%$$%$%%$$$$$$$$$$%%%%%%%%%%%%%%%$$$$%%??????*%%%*;+?%%%%$$$%****?*%@@######@@@@@@@@@##$%%%%%??**+*
$$%%%%%%%%%%%%%%%%%%%%$$$$$$$$$$$$$$$$$%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$############################@@@@@@@@@@@@@@@#@#$%%%%$$?%??$@#*$#$$##$$$$$%?%???%$$$$$%*%$#$#$$*$%%%%%%$##$%%%%%%%$$$$$%%%%%++%%%$$$$$$$$$%%%%%%%%%%%%%%%%%%$$$$$%%%%???????%%%%%$%%++?%$$$$$?****???%###########@@@@@@@#$$%%%%??**+*
$$$$%%%%%%%%%%%%%%$$$$$$$$$$$$$$$##$$##$###########################################################################$$$$$%%%%$$$??#%#@?%#%$$$%%%$$$%%%%%%%%%%$$**%$$##??$%%%%%%%###$%$$$$$$$$$$$$$$*+%$$%%%%%%%%%%%%%%%%%%%%$%%%%$$$$%%%%%%%%%%%%%%%%%%%%%%%**%#####$++?*??%%$##@@@@@@@####@@@@@#$$%%%%??**+*
$$#$$$$$$#######################################################################$$$###$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$$$%*$$?$#?%@$$$$%$$$$$$$$$$$$$$$$$****%%?*%#$$$$$$$%####%%%%%%%%%%%%%*;?%%%%%%%%%%%%%%%%%%%$$$$$%%%%%%%%%%%%%%%%$$%%%%%%%%%%%%%%$#####$?*++??%$#########@##@@###@####$%%%%??**+*
#####################################################$$##$$$%$%%%%%%%%%%%%%%%%%%%%%$$$$$$$$$%%%$%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$%*#%%$$*%@$$$$$$$$$$$$$$$#$$$$$$%+++***?$#$$$$$$$%%###$%%%%%%%%%%%*+?%%%%$$$$$$$$$$$%%$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%$$$$$$$$#######$%+?*+?%###############@@#######$$%%%??**+*
#####################$$$$$$#$$$$$$$$$$%%%%%%%%%%%%%%%%$$%%%%%%%%%%%%%%%%%%%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#$$%*%$#$**$#$$$$$$$%$%%%%%$#$%%%%%$%*+**?$#$$$$$$$$$%%##@#$$$$$$$$$?+?$$$$$%%%%%%%%%%%%%%%%%%$%%%%%%%%%%%%%%%%$$$$#########$$$$$#####$*?*%?$###################@#####$$%%%?**++*
$$$$$$$$%%%%%%%%%%%%%%%%%$$%%%%%%%%%%%%%%%%%%%%%%%%%$$$%%%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%$$$$$?***+*?##$$$$$$$$$$$$$$$$$$$$$$$$$%%%###$$$$$$$$$$%?$@@@$%%%$%?*;?$$$%%%%%%%%%%$$$$$$$$$%%%%%%%$$$$$$$##################$$$$$####$??*?%%####################@@@####$$%%?**++*
%%%%%%%%%%%%%%%%%%%%%%%$$$%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%$$$$%%%%%%%%%%$$$$$$$$$$$$$$$$$$$$%*+++?##$$$$$$$$$$$$$$$$$$$$$$$$$$$###$$$$$$$$$$$$$$%%$#@#$$?*++?$$$$$$$$$$$$$$$$$$$$$$$$######@@@@@@@@@@##################$$####$?*?%%########################@###$$%%?**++*
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%$$$$$$$$$$$$%%%%%%%%%%%%%%%%%$%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%??%##$$#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%???%?*++?%$$$$$$$$$########@@@@@@@@@@@@@@@@@@@@@###########################%*??%#########################@###$$$%?**++*
$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%$$%%%%%%%%%%%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$###$$$$$$$$$$$$$$$$$$$#$$$$$$$$$$$$$$$$$##$$$########%**?$##########@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###########################???%$#############################$$$%?**+**
$$$%%%%%%%$$$$$$$$$$$$%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$##################@@@@@@@@@@@@@@@@@@##@######################@@@@@@@@@@@@@@@@@@@@@#########################$???%$##############################$$%??*+**
$%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$##$$#######################@#@@@@#######@@####@@@@@@@@@@@@@@@@@@@@@@#############################@@@@@@@@@@@@@@@#########################$*?%%###$????????%$%%%%%$$$$########$$%?**+**
$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%$$$$%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$#####################@@@@@@@@@@@@@@@@@@@@@@@#############################@@@@@@@@@@@@@@@@@@@@@#####################################@@@@@@@@@@###@###################$??%$#@##%%%%?????%*********$#######$$%?**+**
$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$##############################@########@@@@@@@@@@@@@@@@@@@@@@@@@@@@#######################@@@@@@@@@@@@@@@@@@@@@@#########################################@@@@@@@@@@@###################$??%$#@#########$*%$$$$$$$$%?#######$$%?**+**
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$###################################################################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###############@@@@@@@@@@@@@@@@@@@@@@###########################################@@@@@@@@@##############$$$$$$%*??$#########$$*%$$$$$$$$$$*#######$$%?**+**
$$$$$$$$$$$$$$$$$$$$$$$$$############@@@##@@@@@@@@###########################################################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@######@@@@@@@@@@@@@@@@@@@@@@############################################$$##$$$$$$$$$$%%%%%%%%%%%%%%$%***#########$$*%$$***???????#######$$%?**+**
#################################@@@@@@##@@@@@@@@###########################################################@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#########################$$$$$$$$$$$$$$$$$$$%%%%%$%%%%$$%%%%%%%%%%%%%%%%%$%%%$########$*%$$$%%%%????*%#######$$%?*****
#################################@@@@@###@@@@@@@##########################################################@@@@@@@@@@@@@@@#######@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@##########$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%$%?%$#######$*%#$$$$$$$$$$#$*#######$$%?*+***
########################################@@@@@@@#########################################################@@@@@@@@@@@@@@@@@@@@@#########@@@@@@@@@@@@@@@@@@###############$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$$$$$$$$$$$%%$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%$%?%%######$*%$$#$$%%%%%%$$%?#######$%%?*+***
#######################################@@@@@@#########################################################@@@@@@@@@@@@@@@@@@@@@@@@@@@###################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$$$$$$$$%$%%%$%%$$%%%%######$$$$$#$$?********$#######$%??*+***
######################################@@@@@@@#######################################################@@@@@@#@#############$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%$%$$$?%%############$$$$$$$$$$$#######$$%??*+***
#####################################@@@@@@@####################################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$$$$$$$$$$$%$$$$$$$$$$%$$$$$%?%$############$$$$#############$$%?**+***
####################################@@@@@@################################$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%$%$$$%%%#############$$##############$%%?*++***
###################################@##########$$$$$$$$$$$$$%$$$$%%%%$$$$$$%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$$%%%%%%%%%%%%%%%??%%%%%%%############$$#############$$%%?*++***
##########$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%$$%%%%%$$%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$%%%%%%%%%%%%%%?%%?????????????????????%%?%%$#########################$$$%??*++***
$$$$$$$%%%%%%%%%%%%%%%%?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$$%%$%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%???????????????????????????????????????????%%?%?$#######################$$$%%?**+****
%%%%%??????????????%%%??%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%$$$%%$%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%$%%%%%%%%%%%%%%?????????????????????????????????????????????????????????%%%%%?*?#######################$$%%??**+***?
%%%%??%%??????????%??%??%%%%%%%??%%%%%%%%%%%%%%%%%%$$%%%%%$$%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%?%%%???????%???????????????????????????????????????????????????%%??%%??%%%??%?$####################$$$%%?**++***?
%%%%%%%????**??*?*??*???%%?%%%%?%?%%?%%?%%?%%%%%%%%$$%%%%%$$%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%%%???%??%%??????????????????????%??????%%%??%???%???%??????%%%?%%%%%%%%##################$$%%%??**++***?
%%%%%?%???***??*?*??????%%?%%%%?%%%???%?%%?%%%%%%%%$$%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%%%??????????%???%%%?%%%%%%???%%%%???%%??????%????%???%??%??%%?%%%%%%%%%$##############$$$$%%??***++***?
%%%%%%%???***??????*????%%?%%%%?%%%???%????%%%%%%%$$%%$$%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%%%%%%%%%%%%%%%?%?%%%??%%?%%%??%%%??%??????%%??%%???%???%%??%%%%%%%%%%%%$$########$$$$$%%%??***++***?
%%%%%%%????????*????%????????%%?????%???%%?%%%$%%%%%%$$%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%??%?%%%??%%%?%%??%%??%%%?%%???????%???%???%%?%%???%???%%%%%%%%%%%%?%#####$$$$$$%%%???**+++***?
%%%%%%%???%??%%???%%%%%?%%%%%%%%%%%%%%%%%%%%$$$$%%$%$$$%%$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%??%%??%%??%%%??%??%%%?%%%%?%%%???%%?%??????%%%%%%%%%%%%%$$$$$$$$$%%%%???***+++***?
%%%%%%%%??%?%%%%%%%%%%%%%%%%%%%%%%$%$$$$%%%%%%%%%%%%%%%%????????????%????%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%%%%%?%%%%%%%%%%%%%%%%%?%%%%%%%%?%?%%????????????%%????%?%%%%%$%$$$$$$$$$$$%%%%%????***+++***?
%%%%%%%??%%%%%?**?*?*?*?%%%?%%%?***?*****?**??*?????????????????????%%???%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%??%%%??%%?????????????%%%%??%%?%%%%%%%%%%%%%%$%%%$%%%%%%?????***++****?
%%%%%?????????*++*+?****%%???%???*??*??******?*%????????%%%%??????%%%??%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%????%%%%%?%%%?%%%??%%%%%%??%%%??%%%%%%??%%%%??%?%%%%%%%%%%%%%%%%%?%%????****++****?
??????????????????*?****?%?%?%????*???*??*????*???????????????%%%??%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%??%%%%%?%%%%%?%%%%%%%%%%%%%%%?%%%%%%%%??%%??%%%%?%%%%%%%%%%%?%%????????***++****?
??????????????????????????%%%????%????%%%%%%%%%%???????%%%%%%%%?%%?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%%%%%%%%%%%?%%%%?%%?%%??%%%%%%%%%?%%%%%%%%%%?%%%%??????**+++***??
??????????????????????????????????????%????????%??%%%?%%%%??%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%??????**+++***??
??????????????????????????????????????%???????%??%%??%%%?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%???????***+++***??
?????????????????????????????????????%??????????%%%??%%%?%%%%%%%%%%%%?%%%%??%%%%%%%?%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%%%%%%%%???????***++****??

Any help would be greatly appreciated, thank you! 🙂

Asked By: PyBatch

||

Answers:

Can you try this solution. At a high level it reads the raw ascii text from a text file, creates a blank image, writes text to image, and saves to a png file.

from PIL import Image, ImageDraw

# read ascii text from file
text_fp = "./my_text.txt"
with open(text_fp, 'r') as f:
    ascii_text = f.read()

# Create a new Image
# make sure the dimensions (W and H) are big enough for the ascii art
W, H = (3000,3000)
im = Image.new("RGBA",(W,H),"white")

# Draw text to image
draw = ImageDraw.Draw(im)
w, h = draw.textsize(ascii_text)
# draws the text in the center of the image
draw.text(((W-w)/2,(H-h)/2), ascii_text, fill="black")

# Save Image
im.save("final.png", "PNG")

I get the following image: output

https://stackoverflow.com/a/1970930 was helpful in crafting the solution

Answered By: karatekraft
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.