BMP to ASCII

I need a routine to copy BMP images to ASCII text output, just the pixel values, that is, I don't want to decipher fonts, I have images containing no text, and I need to read the pixel values into a VHDL simulator that only accepts ASCII format.

Thanks,

b r a d @ a i v i s i o n . c o m

Reply to
Brad Smallridge
Loading thread data ...

An unencoded TXT file, which one could call ASCII, is also a byte binary file.

The O.P. just needs to do a search to find the file format.

formatting link
Mike

Reply to
blueeyedpop

There is no such thing as a 'BMP to ASCII' converter. but there may be a 'BMP to ASCII-art' conterver ! But that is not what you want.

....I don't know what VHDL SIMULATOR is, but you have some homework to do: What a FILE FORMAT is !

BMP is a fileformat made by MICROSOFT for raster images JPG is a fileformate made by COMPUSERVE for raster images DOC is fileformat made by MICROSOFT for text files .....and so on

A fileformat consits of two parts : a FILE-HEADER and a folowing DATA part .....

Thees two parts are joined into one long ASCII string and writen onto your hdd and becomes a file .... Later you may command a program to open this file , the program will analyse the first part of the file ( the file-header) and if it is a format it supports it will contiue read , otherwise stop !..........................

Fonts & text do not exist inside a BMP image/file , It's just raster pixels ( but the pixels may look like text ;o)

The BMP file format is old, and should be easy to understand , so that you can make a prog that opens BMP files - remove the BMP FILE HEADER and passes along the pixel values throug your ASCII databus (a file on the hdd) to the VDHL device (in a VDHL FORMAT ?)

reg A.P.

Reply to
A.P.

The AVR edit distribution at

formatting link
a small "a small bitmap-to-array editor." It has worked good for me in the past. Matt Meerian

Reply to
Matt Meerian

I hope you are wrong.

That's right.

VHDL and Verilog are simulation languages.

Reply to
Brad Smallridge

Can you be more specific?

Reply to
Brad Smallridge

As part of a machine vision experiment, I wrote subroutines to read and write BMP image files (24bpp only) into and out of 2D RAM arrays. Email me if you want this code (it's in C, and in fact constitutes a sneak preview of the book I finished a couple of months ago, so it's freely redistributable)

Reply to
Lewin A.R.W. Edwards

The BMP file format has many sub-variants. The easiest to work with, and the most generally useful, is uncompressed 24bpp color bitmaps.

Make your square all black with a red pixel in one corner, a green pixel in another corner, a blue pixel in the third corner, and a white pixel in the fourth corner :)

Reply to
Lewin A.R.W. Edwards

I think you will have to read aboat and understand the 'BMP-file-format'.

formatting link
page explain the bmp-format . It shows you that all BMP files starts whit the two ascii-charcters : "BM" (Then all computer programs world-wide that is commaned to open this file will know that this file is 99% likely to be a BMP image.)

Then you can open BMP files , peal of the header part and present the ascii data's (for the color-channels you want) to your VHDL simulator in a way that makes sense .

BMP is a fileformat . Ascii is not a fileformat. Does VHDL have any picture/image fileformat ?

What shall VHDL do whit the BMP image : Display it on a screen ? Controll a milling tool ? Manipulate the image and save it (in a new fileformat)?

You could use a HexEditor and open a small and simple BMP file (make a small BMP picture [32x32pixels] whit white background and a small black square in the center ) Then you will get a clue of what your are up against :o)

reg A.P.

Reply to
A.P.

The program was used to take a bitmap and convert it into a "C" array of integers. The "C" array was then inserted into the code for an AVR microcontroller, which then put the bitmap on a 128x64 pixel graphical LCD.

Reply to
Matt Meerian

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.