Thread: Converting image files to ASCII

  1. #1
    Registered User
    Join Date
    Sep 2005

    Converting image files to ASCII

    Call me weird but wouldnt it be different if you could convert image files , like .bmp, to ASC characters? Does anyone know where I could learn to do that? or maybe something close to it?

    My main goal is to turn a 2D game into a completly ASC based game. So its a text based game but with character graphics! Right now the only thing i can think of is take each little square that makes an image and turn it into a colored period... I dont know if thats a good start or what. so any help you could provide I'd greatly appreciate it!

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Well there are several methods. Ultimately, you'll need to be able to read a bmp file into your program and process it into data that your program can use to build an ASCII version. The second part will depend on what method you decide to use - whether you use colored periods, or replace regions within a certain range of color with a particular character, or some other method. But if you go to you'll find the formats of all the major picture formats - so you could start there.

  3. #3
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Maybe you want help with the programming challenge! Just kidding of course, but if you do finish converting images to ascii, check that place out. One of the challenges is converting an image to ascii
    Stan The Man. Beatles fan

    When I was a child,
    I spoke as a child,
    I thought as a child,
    I reasoned as a child.
    When I became a man,
    I put childish ways behind me"
    (the holy bible, Paul, in his first letter to the Cor. 13:11)

  4. #4
    Registered User
    Join Date
    Sep 2005
    thanks for the link its a neat site. I'll be using it as a resource for sure. I'm trying to figure out a way to read a bmp and translate it to ASC. I think I'll start with colored periods for simplicity.

    i'll keep you guys posted when I have a more specific question or if i figure it out! (hopefully =p)

  5. #5
    Information Crocodile
    Join Date
    Dec 2004
    This program might help you. Its in VB though.

    Download Page


  6. #6
    Registered User
    Join Date
    Jun 2005

    Cool bmp decoding

    I write a piece these days...
    I try to read bmp files and get their image data in RGB order. The out put is a table
    containing BYTES. Each 3 byte is a color value.

    glColor2u( racher[0], racher[1], racher[2] )
    racher[0] is red
    racher[1] is green
    racher[2] is blue

    I have attached my code here. Use it respectivly pls. I have a lot of comments in there,
    if you know basics for bmp file I think you can understand what I'm doing. This code
    worls for 1,4,8 and 24 bit bmps. BUT it doesn't work with RLE4 and RLE8 Compressions.

  7. #7
    Registered User
    Join Date
    Sep 2005
    it doesnt work it has errors at compile time

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Converting RAW data to ASCII Signed Integers 16-bit
    By Hansie in forum C++ Programming
    Replies: 6
    Last Post: 01-21-2008, 11:50 PM
  3. fopen vs. _open (for BIG image files)
    By reversaflex in forum C Programming
    Replies: 3
    Last Post: 04-01-2007, 12:52 AM
  4. converting audio and video files in C++
    By andy2885 in forum C++ Programming
    Replies: 2
    Last Post: 05-30-2006, 04:29 PM
  5. Dos commands hehe
    By Carp in forum A Brief History of
    Replies: 2
    Last Post: 01-17-2003, 02:51 PM