Colors change in Photoshop when copying a selection from one document into a new document
I'm trying to copy a particular layer out of a Photoshop document into its own new document and export it for use on the web. I'm doing this by right-clicking the layer in the layers palette, choosing 'Select pixels', copying to the clipboard, creating a new document with the default size (based on clipboard contents), and pasting.
This works, but causes the colors in the copied image to change. As an example, a gray divider image goes from
#b0adad (I'm getting the colors in the source and destination image by using the eyedropper tool).
The color modes of the source and destination images are the same (RGB 8-bit), and when creating the new document, I'm accepting the default Color Profile of 'sRGB IEC61966-2.1'. I'm using Photoshop CS5 on a Mac.
Anyone know how I can extract a layer from my image without incurring a color shift?
From the description, your source document may be using a non-sRGB color profile. When you force it into an sRGB document the colors are rendered differently. You can verify this in the original by using
Edit > Assign Profile and selecting sRGB. If the colors shift, that's the problem.
The solution in this case is
Edit > Convert to Profile in the original. Be sure to use "Perceptual" or "Relative Colorimetric" as the method to avoid other undesirable color shifts.
If that is NOT the problem, then you have an adjustment layer or a blend mode (on the layer itself or one above) applied which isn't there when you move that one layer out of the layer stack into a new document. Option-click on the eyeball by that layer to "solo" it, and check your colors. If they've changed, that's the problem. The remedy is to use Copy Merged (Cmd-Shift-C) rather than Copy.
To save a step in copying a layer to a new document, Cmd-click on the layer thumbnail to select the non-transparent pixels on the layer.