# ReplaceAll does nothing with the rgb values of a picture [closed]

In the book "Programming with Mathematica: An Introduction" at the beginning of the chapter on Patterns and rules an example is given where the colors of an image are transformed according to

image=Import[...];
image./{r_,g_,b_} :> 1-{r,g,b}


and the negative of the image is returned.

When I tried to apply this to an image nothing happened though. I checked the FullForm which returned

Image[RawArray["UnsignedInteger8",List[
List[List[111,117,129,255],List[136,139,162,255],List[124,126,149,255],List[62,42,49,255]],
List[List[85,92,97,255],List[144,149,171,255],List[99,98,107,255],List[91,15,7,255]],
List[List[50,60,53,255],List[87,105,92,255],List[150,143,89,255],List[141,120,57,255]],
List[List[82,98,86,255],List[67,81,71,255],List[149,146,97,255],List[106,95,51,255]]]],
"Byte",Rule[ColorSpace,"RGB"],Rule[Interleaving,True]]


So it turns out that 4 numbers ranging from 0 to 255 are used to determine the colors of the pixels but even when I execute image./{r_,g_,b_,x_}:>{255-r,255-g,255-b,x} nothing happens.

I also tried Replace[image,{r_,g_,b_,x_}:>{255-r,255-g,255-b,x},Infinity] but to no avail.

Does anybody know why nothing happens?

## closed as off-topic by m_goldberg, MarcoB, Johu, Henrik Schumacher, José Antonio Díaz NavasOct 19 '18 at 11:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, MarcoB, Johu, Henrik Schumacher, José Antonio Díaz Navas
If this question can be reworded to fit the rules in the help center, please edit the question.

• In a nutshell: Image[] was not atomic when that book was written, but now it is. Look up ReplacePixelValue[] and use that instead, or work with the result of ImageData[] first before converting back to an image. – J. M. will be back soon Oct 16 '18 at 10:37
• @ J.M is computer-less: Thanks a lot! Do you by any chance have a reference to a list of all atoms in the latest version of mathematica? – Gert Oct 16 '18 at 10:49
• Click on the link in my last comment. – J. M. will be back soon Oct 16 '18 at 10:53