How do animals perform detailed active camouflage?
Some of it is voluntary and some involuntary and is detailed in this book. Chameleons have chromatophores (pigment containing light reflecting organelles in cells) which help in their colour change and many factors like age, health, etc does affect it. And no, they do not form a picture on their head and print it on their bodies.