簡體   English   中英

如何將 TXT ASCII 轉為 PNG Python

[英]How to turn TXT ASCII to PNG Python

我一直在努力解決我現在遇到的這個問題。 我嘗試了很多方法將 txt 文件轉換為 png,但沒有一個對我有用。

我一直想將下面的文本文件(該文件的內容粘貼在下面)轉換為 png 文件,我希望它實際上是文本文件的屏幕截圖,但不是字面上的屏幕截圖,這樣我就可以擁有ASCII 文本的 png 圖像。

(StackOverflow 使文本粘貼看起來非常不穩定,但如果將其全部復制並粘貼到 txt 文件中,您將看到 ascii 藝術。)

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

任何幫助將不勝感激,謝謝::)

你能試試這個解決方案嗎? 在高層次上,它從文本文件中讀取原始 ascii 文本,創建空白圖像,將文本寫入圖像,然后保存到 png 文件。

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")

我得到以下圖像: 輸出

https://stackoverflow.com/a/1970930有助於制定解決方案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM