problems about Image with python
Q1:  
Now I am using Python PIL..Suppose I have a picture. And its mode is 'P'  
So which function can I get the inf about its palette?  
When I use function getpixel, it only returns the id in palette  
But how can I know the id stands for which color?  
And how can I get the id of a specific color?  
Is it fixed?  
  
Q2:  
when I convert a 'RGB' mode picture to 'P'  
how can I calculate the original color' position in palette?  
Does the process have a formula?  
  
Thank you!  
problems about Image with python
===

Q1:  
Now I am using Python PIL..Suppose I have a picture. And its mode is 'P'  
So which function can I get the inf about its palette?  
When I use function getpixel, it only returns the id in palette  
But how can I know the id stands for which color?  
And how can I get the id of a specific color?  
Is it fixed?  
  
Q2:  
when I convert a 'RGB' mode picture to 'P'  
how can I calculate the original color' position in palette?  
Does the process have a formula?  
  
Thank you!  