Posted: Wed Mar 10, 2004 11:55 pm Post subject: text picture genereator
i'm trying to make a program that generates text pictures out of normal black and white pictures... here is what i have so far...
code:
var clr : int
var pic : int
pic := Pic.FileNew ("flamebw.bmp")
pic := Pic.Scale (pic, 100, 100)
Pic.Draw (pic, 0, 0, picCopy)
var dots : array 1 .. 100, 1 .. 100 of int
var numbers : array 1 .. 16 of string := init ("1", "7", "3", "C", "2", "6", "4", "5", "0", "A", "D", "F", "9", "8", "B", "E")
for x : 1 .. 100
for y : 1 .. 100
if whatdotcolor (x, y) = 0 then
dots (x, y) := 16
elsif whatdotcolor (x, y) = 7 then
dots (x, y) := 1
elsif whatdotcolor (x, y) = 8 then
dots (x, y) := 15
elsif whatdotcolor (x, y) = 15 then
dots (x, y) := 7
else
clr := whatdotcolor (x, y)
dots (x, y) := clr - 16
end if
end for
end for
var file : int
var row : string
open : file, "picture.txt", put
for decreasing y : 100 .. 1
for x : 1 .. 100
if x < 100 then
put : file, numbers (17 - dots (x, y)) ..
else
put : file, numbers (17 - dots (x, y))
end if
end for
end for
its not that great but works (somewhat)
later ill probably make it so that its only binary instead of hex...
Posted: Thu Mar 11, 2004 1:16 am Post subject: (No subject)
looks better if you change the
code:
"1"
to a
code:
" "
in your 'init' line
Paul
Posted: Thu Mar 11, 2004 4:51 pm Post subject: (No subject)
Very nice, you can actually make the shape out, but it only worked for me with a black and white pic. With a color pic, it said:
array subscript is out of range on
code:
put : file, numbers (17 - dots (x, y)) ..
zylum
Posted: Thu Mar 11, 2004 6:48 pm Post subject: Re: text picture genereator
zylum wrote:
i'm trying to make a program that generates text pictures out of normal black and white pictures... here is what i have so far...
-zylum
Paul
Posted: Thu Mar 11, 2004 7:29 pm Post subject: (No subject)
oh oops, see thats why I do the matching on the history test but don't explain it.
jonos
Posted: Fri Mar 12, 2004 12:45 am Post subject: (No subject)
pretty funky shite, worked really nice for me, it would be awesome with colour pictures, but awesome prog. just gave me an idea.
Tony
Posted: Fri Mar 12, 2004 12:58 am Post subject: (No subject)
what you could do for color pictures is to convert them to greyscale using RGB module and then output text in color sampled from the original picture.
code:
var clr : int
var pic : int
pic := Pic.FileNew ("flamebw.bmp")
pic := Pic.Scale (pic, 100, 100)
Pic.Draw (pic, 0, 0, picCopy)
var dots : array 1 .. 100, 1 .. 100 of int
var numbers : array 1 .. 16 of string := init ("1", "7", "3", "C", "2", "6", "4", "5", "0", "A", "D", "F", "9", "8", "B", "E")
var dotcolor:array 1..100, 1..100 of int
var fontID:int := Font.New("lucon:8")
for x : 1 .. 100
for y : 1 .. 100
if whatdotcolor (x, y) = 0 then
dots (x, y) := 16
elsif whatdotcolor (x, y) = 7 then
dots (x, y) := 1
elsif whatdotcolor (x, y) = 8 then
dots (x, y) := 15
elsif whatdotcolor (x, y) = 15 then
dots (x, y) := 7
else
clr := whatdotcolor (x, y)
dots (x, y) := clr - 16
end if
Posted: Fri Mar 12, 2004 1:03 pm Post subject: (No subject)
Seeing as people love their colour pics...how about you just convert all pics into greyscale before you run your procedures on them. jawaharyousuf has a fairly decent greyscale filter...and what would you know, so do I!
PM me if you'd like some code with that...but seeing as you are zylum you shouldn't have too much trouble emulating it...
SuperGenius
Posted: Mon Mar 15, 2004 3:09 pm Post subject: (No subject)
Jonos, why is it that you have 0% of your status bar above your avatar filled, even though you have close to 750 posts?
octopi
Posted: Mon Mar 15, 2004 3:10 pm Post subject: (No subject)
Its cause jonos is a LAMER
Cervantes
Posted: Mon Mar 15, 2004 7:57 pm Post subject: (No subject)
*In a last ditch effort to get things back on topic (the discussion veered off when a question was asked about Jonos' status bar *glare*), Cervantes tries a revelutionary new tactic!*
Cervantes: Nice program Zylum! My only complaint is that its kinda big. I guess there's no way to make the font size outputted smaller.. I wonder if that's similar to how they did the ascii matrix that can be found here.
EDIT: Unfortunately, Cervantes' valiant effort is shrouded by the fact that his post was half spam.
Cervantes: Shucks! Next time....
SuperGenius
Posted: Mon Mar 15, 2004 8:40 pm Post subject: (No subject)
octopi wrote:
Its cause jonos is a LAMER
I gathered that much, but what did he do to deserve that lowly status?
AsianSensation
Posted: Mon Mar 15, 2004 8:42 pm Post subject: (No subject)
do remain on topic please. And to answer your question, jonos asked for it. (He literally did, not joking)
Paul
Posted: Mon Mar 15, 2004 8:43 pm Post subject: (No subject)
He asked for it, I mean literally cause he thought it would be cool.
Anyway, is it possible to have the text in different colors?