3
$\begingroup$

ReplaceAll seems not to reach inside Image, and I don't see why it shouldn't. Here is an example. Create a black and white image with four pixels:

image = Image[{{1, 0}, {0, 1}}]

The full form of image is:

Image[List[List[1.`, 0.`], List[0.`, 1.`]], "Real", Rule[ColorSpace, Automatic], Rule[Interleaving, None]]

The following line switches the pixels as desired:

Image[ImageData[image] /. n_?NumberQ -> 1 - n]

My question is, in the following usage, why doesn't ReplaceAll reach inside Image and accomplish the same?

image /. n_?NumberQ -> 1 - n
$\endgroup$
0

0

Browse other questions tagged or ask your own question.