Field guide
Sample the pixel you actually want
A logo edge, a JPEG photograph and a transparent PNG can each give a surprising answer. Pick a point that fits the question.
Choose a flat interior
To recover the fill of a flat icon, sample a point well inside the shape in the original image. A softened edge blends the shape with its surroundings. A tiny screenshot magnified in a document may already contain resampled pixels. A soft transition can have a different valid code at each position.
For a leaf or a piece of fabric, take separate readings from a lit area, a midtone and a shadow. Keep each location with its value. One pixel can describe one highlight while saying very little about the object as a whole.
Keep the alpha channel
The fourth pair in #RRGGBBAA records opacity. The pixel #FF000080 is red with an alpha of 128/255. Under ordinary source-over compositing in encoded sRGB, it appears as #FF7F7F over white and #800000 over black. A screenshot of the pink composite contains a different value from the partially transparent source pixel.
A fully transparent pixel contributes no visible color of its own. Image decoding and canvas processing can also lose the hidden RGB values of fully transparent pixels. Record the background whenever you describe a translucent sample by sight.
State which pixels the reading describes
An image can carry a color profile. A browser may convert the decoded image into the working color space of its canvas. An sRGB hex result describes that sampled rendition. If you need to exchange the original wide-gamut values, keep the file and its profile.
A useful handoff
For a swatch sampled as #15BE7B, save the file, sample position and original hex. Add “near Fennel Fiesta (#00BB77)” when sharing the sample with someone who wants a descriptive name.