Megalith
Well-known member
- Joined
- Aug 21, 2006
- Messages
- 66
- Programming Experience
- 10+
Can somebody help me with this problem, I have a picturebox on my form which is loaded with an image using an openfile dialog control and scaled to fit the picurebox. What i am trying to do is obtain the colors used in the image on the picturebox, my initial thoughts on this was to create a collection and add to it new colors on a pixel by pixel method as they are found and counting the number of occurances of each color, then i found the palette method and it occured to me i could extract this palette from the picturebox and that it should be already sorted by frequency. this is what i wrote thinking this is an easy solution.
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
this however didnt work throwing an exception.
is there a way to do this? is the colors in the palette in order of useage?
	
		
			
		
		
	
				
			
			
				VB.NET:
			
		
		
		Dim p() As Color = PictureBox1.Image.Palette.Entries
        Dim NumColors As Integer = p.Lengththis however didnt work throwing an exception.
is there a way to do this? is the colors in the palette in order of useage?
 
	 
 
		 
 
		 shame tho it appears to be a very simple method to solve my problem. maybe there is another method in some dark dank corner of the VB code
 shame tho it appears to be a very simple method to solve my problem. maybe there is another method in some dark dank corner of the VB code  getpixel is not slick in any sense of the word but if its the only way then it will have to do.
 getpixel is not slick in any sense of the word but if its the only way then it will have to do. 
 
		 
 
		 
 
		