Comcast and NBCUniversal are looking to open a Universal theme park in China in 2019. Being able to add DreamWorks’ stable of characters would be a welcome boost. Gabriel Bouys/AFP/Getty Images

It’s happening: NBCUniversal is buying DreamWorks Animation SKG. Owned by cable conglomerate Comcast, the media giant will add the studio to its portfolio for $41 per share in cash, bringing the value of the deal to $3.8 billion.

“DreamWorks Animation is a great addition to NBCUniversal,” Steve Burke, CEO of the Comcast unit, said in a statement. “Jeffrey Katzenberg and the DreamWorks organization have created a dynamic film brand and a deep library of intellectual property. DreamWorks will help us grow our film, television, theme parks and consumer products businesses for years to come.”

DreamWorks’ soon-to-be-former CEO Jeffrey Katzenberg will get himself a fresh role as part of the deal, becoming chairman of DreamWorks New Media, a new digital-focused arm of the company that includes the online video shop AwesomenessTV.

“I am incredibly excited to continue exploring the potential of AwesomenessTV, NOVA and other new media opportunities, and can’t wait to get started,” Katzenberg said in a statement.

DreamWorks is basking in the glow of a massive success in “Kung Fu Panda 3,” which has clocked in with a global box office take of more than $500 million — $362 million of it outside the U.S. The film did gangbusters in China, now considered the most crucial entertainment market.

Not coincidentally, Comcast and NBCUniversal are also looking to open a Universal theme park in China in 2019. Being able to add DreamWorks’ stable of characters, such as Po (from “Kung Fu Panda”), Toothless (from “How to Train Your Dragon”) and Shrek (from “Shrek”), to the Universal menagerie, including the ubiquitous Minions, is a welcome boost.

That’s particularly important given the future park’s competition. Walt Disney is set to open its own theme park in Shanghai — Shanghai Disney — in June. Beijing and Shanghai aren’t exactly close (a 12-hour drive, five-hour train ride or two-hour plane flight between them), but that merely increases the opportunity cost potential visitors will have to weigh when choosing their destinations.

Shares of DreamWorks were up a whopping 19 percent, to $32.20, on the news. Comcast shares were down a tick, 0.1 percent, to $61.24.

The deal is expected to close by the end of 2016, subject to regulatory approval both in the U.S. and abroad.