"It's mental," said one of the bridesmaids in the wedding where The Dress was worn.

Lindsay Maden, of Blackpool, England, was referring to the sheer nuttiness of the worldwide debate over the color of a piece of fabric.

But she was also correct from a scientific perspective. It is all in the brain.

The garment in question, in case you have not been near a smartphone or computer in a day or two, is a blue-and-black dress that, to many people, unquestionably appears white and gold in a photo posted on the social networking site Tumblr.

Several factors could account for the differing perceptions of the image, which has prompted millions of Internet clicks, vehement celebrity tweets, and untold hours of squandered worker productivity. (Just Google #thedress.)

But the main reason, according to experts in human vision, involves the sorts of everyday adjustments that the human brain makes to compensate for differences in lighting and background colors.

Your white shirt takes on a bluish cast when you stand outside at twilight, because it is reflecting the bluish wavelengths of the darkening sky. But your brain still perceives it as white because it adjusts for the darkness, said Mitchell Fineman, associate professor of ophthalmology at Wills Eye Hospital. Conversely, a dark-colored object can appear much lighter as we move into bright sunlight.

These kinds of automatic adjustments are useful, said David H. Brainard, a University of Pennsylvania psychology professor who studies human vision. If our brains were not able to perceive the constancy of objects as we moved among different surroundings, things would seem pretty chaotic in a hurry.

If an object is removed from its context and plastered all over the Internet, however, people's brains fill in the gaps in different ways, said Fineman, the ophthalmologist.

Most observers seem to agree that in the original photograph, the dress has a bluish tint. But is it a white-and-gold dress shown in the shadows? Or a blue-and-black dress in bright light?

Fineman sees white - but readily acknowledges that many others perceive it differently.

"I'm subtracting the blue to make white," the eye doctor said. "They're subtracting the lighter color to make blue."

Sure enough, when Fineman showed the image to Wills Eye chief executive officer Joseph P. Bilson, there was no hesitation.

"Blue and black," Bilson said.

According to various media accounts, including the Daily Record in Scotland, the actual dress is indeed a royal-blue-and-black number, worn by the mother of the bride at the wedding in Scotland. The seller was a store called Roman Originals.

It is hard to get a complete understanding of why people are seeing different colors in the dress without a formal study, said Brainard.

The perception of color can be influenced by lighting as well as surrounding colors, the psychologist said.

Google artist Josef Albers, for example, and you can find several works in which two squares of the same color will appear different - orange and brown, say - depending on the colors that surround them.

"The brain codes color relative to everything else in the image," Brainard said. "The brain is basically constantly adjusting what you might call its color balance, its white balance."

Another possible contributing factor to the differences in opinion on the dress is more mundane, he said. People may simply have their computer monitors turned to different settings.

One thing is clear:

"Obviously we don't all see the same," said Wills Eye's Fineman. "People are adamant."

215-854-2430