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!

reduce the colours in a bitmap

Status
Not open for further replies.

davidrobin

Programmer
Aug 17, 2000
50
0
0
GB
I have an application where I load an image into a picturebox.

What I want to do is simplify the colours. e.g. I want only the following colours in the image.
white
light blue
dark blue
yellow
pink
red
dark red
black
light green
dark green
light grey
dark grey
orange
there are a few others but these are a most of them.

So for each pixel in the image I want to replace it with the closest match from above.
I believe there are two possible ways of doing this;

for each pixel compare its value with the list above and find the closest match then replace it with that.

replace the palette of the image by assigning it the palette of another image , I believe it can be don like so
bitmapobject.palette = anotherbitmap.palette.

It was suggested that the system.drawing.imaging.colorpalette (or something like that) could be used but despite my looking for ages I have not found any examples.

Can anyone suggest which way is best, or another way if there is a better one.
Also any code examples would be appreciated.

Many thanks

David
Visual Basic 6 Ent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top