Like the city it’s named for, “Rio” is a brightly colored confection full of samba music, crime, and monkeys. An animated film intended primarily for kids, it also passes the grown-up test, with enough good-natured comedy and general intelligence to keep it from driving you crazy after your children have watched it on DVD a hundred times.

It was conceived and directed by Carlos Saldanha, who directed or co-directed all three “Ice Age” movies and “Robots” before returning to his native land for inspiration. Fittingly, it’s a story about someone coming home to Brazil: a blue macaw taken from the jungle as a hatchling who has lived all of his 15 years as a pet in Minnesota.

Blu, as he is named, is voiced by Jesse Eisenberg, which also tells you that he is neurotic, timid and nerdy. He loves his human companion, a bookish girl named Linda (Leslie Mann), and each is glad to have the other as a best (and only) friend. Not one to pine for the jungles he barely remembers anyway, Blu is content to be domesticated. He never even learned to fly.

Then comes word that Blu is the last male of his species, and a devoted Brazilian ornithologist named Tulio (Rodrigo Santoro) wants him and Linda to come to Rio so that Blu can be “introduced” to the one remaining female. Yes, Blu is headed to Rio de Janeiro for the sole purpose of having sex! He is hardly the first. (Don’t worry, parents, that aspect is treated with suitable discretion. There will be no need afterward for you to explain to your children what a cloaca is.)

Reluctant to leave the safety of her nerd-nest but knowing it’s the right thing to do, meek Linda takes wimpy Blu to Rio to do the deed. And just in time for Carnival! (Trivia: It is always Carnival in Brazil.) The lady bird, Jewel (Anne Hathaway), is more interested in escaping from captivity than in perpetuating her species, and looks on the domesticated, unflying Blu with disdain. Then both are abducted by exotic-bird smugglers and chained together at the foot, whereupon they escape and go on the lam, forced to travel together until they can find Linda and/or a hacksaw.

As you can see, the story is standard. The tame animal terrified to be in his natural habitat recalls “Madagascar”; everything else recalls most of your classic animal-based Disney films, not to mention the sub-genre of comedies in which two unwilling participants are physically bound together. All the story elements related to the humans feel tacked on out of obligation. Once the movie gets going, it doesn’t have a single unpredictable plot point.

Not to worry, though, because the specifics are much more imaginative and delightful. The animal smugglers are assisted by a turncoat, an imperious cockatoo named Nigel (Jemaine Clement, “Flight of the Conchords”) who is bitter at having lost his good looks. Nigel sings a song written by Clement, a cleverly rhymed and wickedly funny number called “Pretty Bird.” (Brazilian jazz legend Sergio Mendes is the film’s music supervisor.) There is a gang of monkeys who pick tourists’ pockets and are coerced into helping Nigel find Jewel and Blu, and their few minutes of screen time are some of the film’s funniest. There are various colorful birds who lend a hand, voiced by the likes of Jamie Foxx,, and George Lopez, as well as a slobbery bulldog played by Tracy Morgan.

It’s clear that Saldanha is proud of his homeland, favelas and all. Under his direction, the film’s panoramic views of Rio are stunningly rendered in gorgeous, vibrant detail. The characters are drawn to reflect the many combinations of ethnicities found in Brazil, and there are affectionate pokes at the country’s preoccupation with soccer and public revelry. As a love letter to Rio, the film has been made with such sunny enthusiasm that it’s easy to disregard its over-familiar story and just enjoy the samba.

(Note: Saldanha has “story by” credit, but the actual screenplay is attributed to Don Rhymer, Joshua Sternin, Jeffrey Ventimilia, and Sam Harper. Among them, those four men are responsible for “Surviving Christmas,” “Deck the Halls,” “Yogi Bear,” “Tooth Fairy,” “Cheaper by the Dozen 2,” “The Honeymooners,” and “Big Momma’s House” 1 and 2 — some of the worst comedies of the last decade, in other words. “Rio” is evidence that even repeat offenders can find redemption.)

B (1 hr., 36 min.; G, has some mild crude humor (originally rated PG, was re-rated).)