Click here to Skip to main content
15,902,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've a 5 color image and i want to break this image into 5 different image on the basis of color so that each image has only single color.
Posted
Comments
Kenneth Haugland 9-Aug-12 3:52am    
You mean a 3 color image with Alpha, or is it something im missing?

1 solution

1. get colour of pixel in image
2. add to list of colours in image if not already present in list
3. return to step 1 until all pixels examined

4. get pixel
5. is pixel = list[i]?
6.  if yes, image[i] pixel = list[i]
    if no, image[i] pixel = black
7. return to 5 for all colors in colorlist
8. return to step 4 for all pixels in image
 
Share this answer
 
Comments
rachitagarwal2828 9-Aug-12 10:12am    
This approach is not working. I am getting 15216 colors in the image
enhzflep 9-Aug-12 11:29am    
You mean, "my implementation of that approach is not working"
Step 1, 2 and 3 are your first move.

Did you try debugging it?
Do you have code to show?

Specific questions get specific answers!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900