You can create a set of color swatches and save them and load them. Photoshop Ships with many set in "Presets\Color Swatches\" I do not use illustrator...
Thank you for your answer. I have managed to create a custom swatch and save it. It might be time consuming, if there are a lot of colors in an image.
Then I found this to create it automatically based on indexed colors of photo. I guess it will work fine if there are not many color in an image (eg. a logo)
To save out swatches for Illustrator save them as .ase - these can be loaded in Ai. Save from the flyout menu in the Swatches panel, and choose "Save Swatches for Exchange". Make sure you have identical color settings in both apps, or the same numbers will produce different colors.
AFAIK you'd have to color pick the swatches manually one by one, although there might be a way to turn an Indexed Color image into swatches (don't know).