News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
Convert bitmap image to ascii
Author Message
Juergen
Member
***


Posts: 81
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
RE: Convert bitmap image to ascii

iGame3D Wrote:
Hey thanks.
Couldn't do ImageMagick as I need a new OS so I purchased Graphic Converter for $35 and it did the magick I needed to do.

So I got this 1983 Custom Ascii Character set batch converted to
256 individual 3D objects, dropped into a game level and blinking
different colors and shades.
Yay! 11,000 + polys of wonder.
Flash Movie of that here!

I don't get that. Do you want to say that you can't run the binary release, because you have an older OSX release? Then you can still install it via macports (macports) or you can run linux in a virtual machine.

With imagemagick it definitely works:

Code:
for image in $(ls *.png); do convert -resize 8x8 -extent 8x8 -monochrome -compress none $image ${image%.png}.pbm ; done

This should also work on OSX. The only problem is that the font uses shadows and I'm not 100% sure that you can scale it down to 8x8 that easy. A little bit of tuning is still necessary and maybe it may be necessary to optimize a few chars by hand.

Quote:
So now, FLTK has some kind of embedded graphic format yes?
Where does the strange data for those images come from?
I've seen it in some scripts and it just confuses me.

So last year I was working on a little graphics creator for the old computer
in murgaLua and had planned to do more with it, but things happened.
Using pngs I was not able to deal with colors and the mouse is
drawing in the window even when you are choosing characters.


Of course this should also work with murgaLua. I can get it working with gifs and xpms, but not with pngs. When I try the data() method on the fltk image buffer I get a string of 1024 nil. While I did get a 1024 character string (16x16=256*4=1024 for rgba), there was no data in there. Maybe there is a bug somewhere or data() doesn't currently support RGB buffers.

You can test it with gifs for examle:
convert a png to gif like

Code:
convert aquarius_chr_006.png aquarius_chr_006.gif


The start murgaLua

Code:
> fltk.fl_register_images()
> my_image=Fl_Shared_Image.get(./"aquarius_chr_006.gif")
> my_image_data=my_image:data()
> table.foreach(my_image_data,print)
1       16 16 -2 1
2        
3                      
4                 !!    
5                 !!    
6                 !!    
7                   !!  
8                   !!  
9       !!!!!!!!!!!!!!!!
10      !!!!!!!!!!!!!!!!
11      !!!!!!!!!!!!!!!!
12      !!!!!!!!!!!!!!!!
13                  !!  
14                  !!  
15                !!    
16                !!    
17                !!    
18                      
d       1
h       16
w       16
ld      0


VoilĂ  tout!

Juergen

01-13-2009 11:03 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
Convert bitmap image to ascii - iGame3D - 01-09-2009, 11:04 AM
RE: Convert bitmap image to ascii - Juergen - 01-13-2009 11:03 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: