Hi !
Here is a total useless script... I know I work sometimes for nothing...
This revolutionary script is able to convert all your bitmap pictures in a (grayscale or colored) ascii art into a text file or a html webpage.
Put it above main:
works on rgss 1 & 2
Using:
RMXP
RMVX
results:
html version
Here is a total useless script... I know I work sometimes for nothing...
This revolutionary script is able to convert all your bitmap pictures in a (grayscale or colored) ascii art into a text file or a html webpage.
Put it above main:
works on rgss 1 & 2
Code:
#==============================================================================
# ** Bitmap vers Ascii Art
#------------------------------------------------------------------------------
# Par berka... http://www.rpgmakervx-fr.com
#
# Si vous trouvez une utilité quelconque à ce script,
# veuillez avoir l'aimabilité d'en avertir l'auteur
#==============================================================================
Tons=['M','@','#','8','0','O','o','c','+','{','|','!',';',':','.',' ']
Fichier_TXT="./ascii.txt"
Fichier_HTML="./ascii.html"
class Bitmap
def to_ascii
fichier=File.open(Fichier_TXT,"w+")
(self.height).times{|y|(self.width).times{|x|
c=self.get_pixel(x,y)
cg=(c.red+c.green+c.blue)/3
cg/=(256/Tons.size)
fichier << Tons[cg]}
fichier << "\n"}
fichier.close
end
def to_ascii_html
fichier=File.open(Fichier_HTML,"w+")
fichier << "<pre>"
(self.height).times{|y|(self.width).times{|x|
c=self.get_pixel(x,y)
cg=(c.red+c.green+c.blue)/3
cg/=(256/Tons.size)
hexa="#"
[c.red,c.green,c.blue].each{|col|hexa+=col.to_i.to_s(16).rjust(2,"0")}
fichier << '<font color="'+hexa+'">'+Tons[cg]+'</font>'}
fichier << "\n"}
fichier << "</pre>"
fichier.close
end
end
Using:
RMXP
Code:
@bmp=RPG::Cache.picture("test_txt").to_ascii
@bmp=RPG::Cache.picture("test_html").to_ascii_html
Code:
@bmp=Cache.system("test_txt").to_ascii
@bmp=Cache.system("test_html").to_ascii_html
results:
html version
