
-----------------------------------
zylum
Wed Mar 10, 2004 11:55 pm

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...

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...

btw, heres the image: http://members.rogers.com/zylum/images/flamebw.bmp

-zylum

-----------------------------------
Tony
Thu Mar 11, 2004 12:54 am


-----------------------------------
not bad, but the image would work better with a font that is square... image looks vertically stretched using most (if not all) fonts :?

-----------------------------------
octopi
Thu Mar 11, 2004 1:16 am


-----------------------------------
looks better if you change the   "1"
to a 

" "

in your 'init' line

-----------------------------------
Paul
Thu Mar 11, 2004 4:51 pm


-----------------------------------
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

 put : file, numbers (17 - dots (x, y)) .. 



-----------------------------------
zylum
Thu Mar 11, 2004 6:48 pm

Re: 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...
-zylum

 :shock: 


 :lol:

-----------------------------------
Paul
Thu Mar 11, 2004 7:29 pm


-----------------------------------
oh oops, see thats why I do the matching on the history test but don't explain it.

-----------------------------------
jonos
Fri Mar 12, 2004 12:45 am


-----------------------------------
pretty funky shite, worked really nice for me, it would be awesome with colour pictures, but awesome prog. just gave me an idea.

-----------------------------------
Tony
Fri Mar 12, 2004 12:58 am


-----------------------------------
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.


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
        
        dotcolor(x,y):=whatdotcolor(x,y)
        
    end for
end for

cls

for decreasing y : 100 .. 1
    for x : 1 .. 100

        Font.Draw(numbers (17 - dots (x, y)),x*Font.Width("*",fontID),y*Font.Width("*",fontID),fontID,dotcolor(x,y))

    end for
end for


shaded greyscale picture

-----------------------------------
Delos
Fri Mar 12, 2004 1:03 pm


-----------------------------------
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!

For jy's:
http://www.compsci.ca/v2/viewtopic.php?t=4009

For mine:
http://www.compsci.ca/v2/viewtopic.php?t=3316

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
Mon Mar 15, 2004 3:09 pm


-----------------------------------
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
Mon Mar 15, 2004 3:10 pm


-----------------------------------
Its cause jonos is a LAMER

-----------------------------------
Cervantes
Mon Mar 15, 2004 7:57 pm


-----------------------------------
*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.. :think:  I wonder if that's similar to how they did the ascii matrix that can be found Cervantes: Shucks!  Next time....

-----------------------------------
SuperGenius
Mon Mar 15, 2004 8:40 pm


-----------------------------------
Its cause jonos is a LAMER

I gathered that much, but what did he do to deserve that lowly status?

-----------------------------------
AsianSensation
Mon Mar 15, 2004 8:42 pm


-----------------------------------
do remain on topic please. And to answer your question, jonos asked for it. (He literally did, not joking)

-----------------------------------
Paul
Mon Mar 15, 2004 8:43 pm


-----------------------------------
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?

-----------------------------------
SuperGenius
Mon Mar 15, 2004 8:44 pm


-----------------------------------
Jonos.... why would you ask for that? lol

by the way do you guys like these cars? becuase I think they rule.

-----------------------------------
Mazer
Mon Mar 15, 2004 8:47 pm


-----------------------------------
Oh come on, SuperGenius could you please stay on topic?

-----------------------------------
AsianSensation
Mon Mar 15, 2004 8:48 pm


-----------------------------------
don't particularly like the car, but I do like the fact that it says GTO (assuming GTO stands for Great Teacher Onizuka).

btw, -20 bits

told you to remain on topic.

-----------------------------------
jonos
Mon Mar 15, 2004 9:07 pm


-----------------------------------
you can't put colour to the text, unless you put it to wordpad and found a way to use tags or something to do that, using sgml or something like that.

wo wait, you could do it, you make it a .txt with html tags, and then copy it and make it an html document, and you could then do it!

-----------------------------------
SuperGenius
Tue Mar 16, 2004 1:06 pm


-----------------------------------
sorry for wandering... but this little app is reather neat. 
My question is: Is there some practical application that it would have?
if no, why did you decide to make it?
