‘The Hobby Horse’ by Robert Peckham. (Courtesy National Gallery of Art, Washington)

Catch sight of “Deacon Peckham’s ‘Hobby Horse’ ” exhibition at the National Gallery of Art and suddenly, almost without volition, you are eye to eye with the painting that inspired it. The portrait of the brother and sister, “The Hobby Horse,” with its intricately detailed riding toy, is the centerpiece of the nine-portrait exhibit so visually compelling, it feels like it has invisible conveyor belts to draw viewers in.

Awash in vibrant colors and sustained attention to interior spaces, the contemplative images of these 19th-century children are so obviously of a type, it is remarkable that they’ve never been grouped together. But like many aspects of the art world, the back story belies the obvious. A gallery exhibit is often the culmination of a research, restoration and cataloguing process that can take long stretches of time to piece together.

“The Hobby Horse” took 30 years.

Donated to the National Gallery of Art in 1955 by Edgar William and Bernice Chrysler Garbisch, who collected 18th- and 19th-century works by artists who were largely self-taught, “The Hobby Horse,” like many pieces in the folk art collection was unsigned. It was displayed for years as “American 19th Century,” and became a beloved and widely reproduced image.

In 1980, the gallery began to produce a systematic catalogue of its collection. Exhibit curator Deborah Chotner, who had arrived that year, said that, from the beginning, the Peckham piece felt special. Over and over, she stared into the children’s unerring gaze — sometimes the actual portrait, sometimes a reproduction on her desk — and thought, “It looks like they are thinking, like they are evolving.”

Attributed to Robert Peckham. ‘The Farwell Children,’ c.1841 oil on canvas (Courtesy Collection American Folk Art Museum, New York)

She turned to experts in costuming and transportation, and historical societies to piece together clues — geographic location, approximate time frame — about the folk art collection. Small details like the children’s sleeves, the styles of which were ever changing, and the small split in the boy’s tunic helped date “The Hobby Horse” to around 1840.

Initially, Chotner thought they’d make the identification through the portrait’s most striking feature: the horse. The hours it must have taken a craftsman to make the hand-carved horse, covered with hide and a horse hair mane and tail, provided a clue to the family’s economics. A consult with the Library of Congress helped determine the newspaper typeface in the painting was from Boston’s Daily Evening Transcript and Chotner discovered that mid-19th-century New England was swelling with the ranks of the newly moneyed from small manufacturing and chairmaking. She had an approximate time and place but further certainties proved elusive. She continued to catalogue other paintings, returning to gaze, from time to time, at the anonymous children who stared right back. She continued to gather data.

In her research, Chotner noted a 1979 article in the American Art Journal by Dale Johnson, a researcher at the Metropolitan Museum of Art in New York. Johnson compared other unsigned portraits of brightly adorned children with transfixing gazes with one in the Metropolitan Museum collection and “The Hobby Horse,” and speculated they’d all been done by Robert Peckham.

Peckham, an ornamental and sign painter, church deacon and devoted abolitionist who lived and worked in Westminster, Mass., became a portrait artist of note. Few of the more than 50 portraits attributed to Peckham were signed, and attributions have been based on style and geographic or familial connections. Most of his work shares the same sense of space, crisp, realistic features and single direction lighting. But his adult portraits, the majority of his work, are set against dark, austere backgrounds, in contrast to the children’s portraits with their vivid, minutely rendered interiors.

Though Peckham remained a notion only, Chotner was able to see possibilities.

She compared paintings. “Sideways, you can see that there’s a brown that’s applied diagonally from lower left to upper right and it turns out that’s an unusual application,” she recalls thinking. What it meant was “if [our painting] wasn’t by Peckham, it was somehow related to him — perhaps the same studio or canvas or supplier.”

But a 1988 article in Antiques magazine by a highly regarded curator cast serious doubt on the Peckham claim. He couldn’t possibly have painted those elaborate children’s portraits, the article said. His adult portraits were just too different. In the art world, no one wants to be wrong on an attribution. This was a major setback.

Robert Peckham. ‘Webster Tucker,’ c. 1844 oil on canvas (Courtesy Jennifer and Tom Eddy)

Chotner began to research mid-19th-century New England child-rearing to try to account for the stylistic differences. She found that the license taken with children’s portraits was rooted in ideas about the home. “At the time, the home was thought to be central in the formation of consciousness,” Chotner says. The children’s paintings concerned themselves with “the interior of self as well as the interior of space.” Beyond the toys and rugs and accouterments, “look at the faces,” she says. “You feel like you’re engaging real people.”

Chotner’s “Hobby Horse” file — a three-ring binder full of observations, asides and comparisons — grew thick and intriguing, but it didn’t yet say Peckham. A 1996 Folk Artmagazine article detailed Peckham paintings donated by local families to Westminster’s Forbush Library. They had the same sharp edges and hard light that came from one direction and made everything look sculptural, Chotner thought.

Then, finally, one day in 2005, Chotner came across a photo of a boy’s portrait in an antiques magazine that she had never seen before. “My heart just leapt,” she says. “That’s our guy!” She tracked down the portrait’s owner through a Boston auction house and paid him a visit. She got down on her hands and knees and looked at every inch of the painting. She took into account lighting, brush strokes, the color palette, the child’s physiognomy, the familiar way he was compressed in a corner space.

In the unsigned “Webster Tucker” painting, the child carried books, and the inside of his black cap featured a beautiful pale pink lining. “But the thing that draws me was just the light on the face,” Chotner says. “It’s just distinctive to this artist.” That painting had been attributed to Peckham.

Chotner came back from that trip (after also visiting Forbush Library and seeing those Peckham works) and proposed a change in attribution for “The Hobby Horse.”

And she suggested a Peckham children’s exhibit. In 2009, the attribution was officially changed, and borrowing from museums and a number of private collectors, nine of Peckham’s most striking children’s portraits went on display together for the first time ever.

In all those years, Chotner says she never “got sick of looking at that picture. We’ve sort of become like old friends.” Notwithstanding the painstaking work of piecing together the data over the years, Chotner says making the final identification was “an intuitive response . . . . It’s the visual capital that you acquire over time. Something feels right and you get a visceral response, then you go back and check the facts and history.”

When a friend recently visited the gallery with her 8-month-old daughter, Chotner says the baby looked at the children and waved. “She felt the same thing I was feeling,” she says. “They were as real to her as they were to me.”

Deacon Peckham’s ‘Hobby Horse’

at the National Gallery of Art, Fourth Street and Constitution Avenue NW., runs through Oct. 8. 202-737-4215. www.nga.gov.