EmbDev.net

Forum: FPGA, VHDL & Verilog Read Bitmap Color depth 4 Bits


von Guest (Guest)


Rate this post
useful
not useful
I have a BMP file that I need to read in VHDL, but I have problems 
reading the colors, to be precise, with a color depth of 4 bits.
With a color depth of 24 bits it looks like this:

    r_in : in std_logic_vector(7 downto 0);
    g_in : in std_logic_vector(7 downto 0);
    b_in : in std_logic_vector(7 downto 0);

8 bits each for RGB.

With a color depth of 4 bits, it had to be different on the outside.

I am thankful for every help.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Guest wrote:
> I have a BMP file
Attach it here, so it can be examined with a simple hex editor.

von Guest (Guest)


Attached files:

Rate this post
useful
not useful
Lothar M. wrote:
> Gast schrieb:
>  > Ich habe eine BMP-Datei.
> Hänge sie hier an, damit sie mit einem einfachen Hex-Editor untersucht
> werden kann.

von FpGaNoTfALlSeElSoRgE (Guest)


Rate this post
useful
not useful
What a silly assignment ... poor students.

von Duke Scarring (Guest)


Rate this post
useful
not useful
Guest wrote:
> With a color depth of 4 bits
4 bit for every color or 4 bits for all together?

von Guest (Guest)


Rate this post
useful
not useful
With a color depth of 4 bits, i.e. 4 bits per pixel.
With 4 bits the colors are indexed, so there are 16 color entries that 
are used.
This leaves 1 byte for RGB each.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
The first part of this kinda stupid exercise is fairly easy: examine the 
structure of the bmp file to find out what index green and blue have and 
where the picture data starts, then open it, read it, replace the 
corresponding nibbles and write it to a new file.

To find and afterwards fill random rectangles is not that easy, 
especially when they may be rotated in any way.

: Edited by Moderator
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.