Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scan a bitmap for &H0& (black)

Status
Not open for further replies.

Toastie

Programmer
May 19, 2001
123
0
0
AU
how can i scan to see if a bitmap has black in it?
 
Depends on bmp resolution. Black in 24 bit mode is three bytes "000"

go to this thread to get headerfile info
thread222-197569

if color palette is used. Look thru color palette(section of file right after header and before actual picture data)
for "000" the order in which the colors are listed is the index value. example color palette

0 0 0
0 5 5
0 4 4

000 is color 0
055 is color 1
044 is color 2

Then picture data like:

0 0 0 1 1 2 2 2

is color 0 three pixels then color 1 two pixels and color 2 three pixels.

 
umm well i have only played with vb for the last year part time and i am not that far up to speed

is there a newbie channel for this sort of thing?

what i want to do is get form1.picture (24 bit bmp) and say mage all black pixels transparent

now if there is an easy way (i know its not like going up the shop) please tell me
dont get me wrong i am willing to learn just that all that is just too high up for me.

i now know that a bmp has a header and an info header and a bitmap info structure

but yeah
help
 
Sorry, haven't worked with transparences and don't have the time to find out for you. But, here is what you can do to find out for yourself. Get a winamp skin that has transparences. Rename the extension to zip and unzip it. You will see about 8~10 bitmaps. Look in each bitmap for transparencies and if you find one. use it to find out which color is used for transparencies. The simples way is to open the data section of the file and look at it as an array of integers by writing a simple VB program.

Someone else might post a simpler ready made method. But if your going to do pixel level editing on a bmp, I suggest you play around with the above Idea. After all, sooner or later you'll have to gain hands-on experience anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top