“The Ant Bully” has a premise straight out of the horror comics of the 1950s, the ones where maybe a kid loves sharpening pencils and then one day the pencils come to life, rise up, and sharpen the kid’s head. In the film, a boy torments the anthill in his front yard, then is shrunk to ant size and taken prisoner by his former victims. How the tables have turned, my friend!

They didn’t go the horror route in “The Ant Bully,” of course. Based on a children’s book by John Nickle, it’s a sweet and adventurous story about the value of working together as a community to make life better for everyone. It’s like Marx’s “Communist Manifesto,” in other words, only funnier.

The boy is Lucas (voice of Zach Tyler), a nerdy, bespectacled kid who is frequently harassed by neighborhood bullies. Frustrated at his inability to fight back, he takes out his anger on the beings who are smaller and weaker than him: ants.

The ants, meanwhile, are a smooth-running colony of happy workers who refer to Lucas as the Destroyer and run in terror when he approaches. They have a wizard among them, Zoc (Nicolas Cage), who finally perfects a potion that, when poured into Lucas’ ear while he sleeps, reduces him to a more manageable size.

Lucas is brought before the ant tribunal, where the head of council (Ricardo Montalban) reads the charges against him (“… and he did douse the colony with the dreaded yellow rain …”). Zoc says he should be put to death. But Zoc’s girlfriend Hova (Julia Roberts) takes pity on the boy and offers a different solution: Let her take him under her wing, as it were, and teach him how to be an ant. The queen ant (Meryl Streep) agrees that perhaps this will lead to greater understanding between the ants and the humans and bring about peace between them.

So there’s the central group, kindly Hova, frightened Lucas, and jealous-angry Zoc, working together in the colony. We also meet Kreela (Regina King), a tart-tongued foraging instructor, and a swaggering scout named Fugax (the perfect Bruce Campbell). The conflict they all must fight against? The exterminator (Paul Giamatti) who’s scheduled to come wipe out the ants for good.

With writing and direction by John A. Davis (“Jimmy Neutron: Boy Genius”), the film is filled with wide-eyed wonderment and Pixar-style heart and soul. The ants herd caterpillars the way humans herd cattle, they’re enemies with an evil nest of wasps (I think the wasps should have had snooty New Hampshire accents — you know, WASPs), they love eating whatever fruit-like stuff it is that comes out of the back of caterpillars. It’s fun, you know? There’s even a scene set inside a frog, like Pinocchio in the belly of Monstro.

The animation is top-notch, too, clearly done with quality, not cheapness, in mind.

It’s been noted that the film is an expansion of the slim, sparse children’s book. I don’t know which details are holdovers from the source material, but there are several elements of the film that are simply unnecessary. Lucas’ conflict with his mother — he’s pouting and doesn’t tell her goodbye before she goes out of town for a weekend trip — is extraneous, and so is his grandmother’s UFO-fearing craziness. (For that matter, the grandma character doesn’t do anything useful, though I guess the kids need a babysitter if Mom and Dad are gone.)

It’s good stuff, overall — funny, fast-paced and lively, and better than most of the animated films released this year. Maybe it would have been better if the ants had eaten tiny Lucas, but maybe that’s just me.