A CARTOONIST, a legal defender and a presidential Twitter account walk into a coffee bar …

From such setups come the newest idea for a Trump humor book. The cartoonist, Shannon Wheeler, is drawing “Sh*t My President Says: The Illustrated Tweets of Donald J. Trump” for release in August, publisher Top Shelf Productions will announce today. The book will feature more than 100 works by the Eisner Award-winning cartoonist, whose clients include the New Yorker, MAD and the Onion.

“A friend suggested the idea,” Wheeler says of Charles Brownstein, who heads the Comic Book Legal Defense Fund. “We were having coffee and … he said: ‘You should illustrate Trump’s tweets.’

“It might have been a joke to shut me up. I started work that night.”

That work involves culling through President Trump’s tens of thousands of tweets to separate the potential laughs from the chaff. Only certain kinds of Trump tweets lend themselves to illustration, and Wheeler — creator of the comic “Too Much Coffee Man” — needed to establish some criteria.

“I looked for tweets that give insight into who he is,” Wheeler tells The Post’s Comic Riffs. “I started with lists other people created — most outrageous tweets, tweets against celebrities, etc. This was a great starting point.

“I then solicited help, via my Twitter followers, to get a comprehensive Twitter text files. There are over 30,000,” Wheeler continues. “I read them sequentially. When I noticed themes, I’d collect them — global warming, windmills, David Letterman, Obama’s vacation time and birth certificate, etc. I’d string together tweets to make a narrative arc.”

One such arc involved the Trump University legal story. Wheeler says those tweets progressed from “variations of ‘I’ll never settle’ to ‘I settled the Trump University lawsuit for a small fraction of the potential award because as president I have to focus on our country’ — which doesn’t make sense on a couple of levels.”

The Oregon-based cartoonist notes that his goal is not simply to spoof the president, but to build a sort of composite sketch of the man. “I’m not turning him into a caricature,” Wheeler says. “A lot of people are doing that already. I’m trying to understand him and the image he has of himself.”

Delving deep into Trump’s collected works of Twitterature, Wheeler can draw the small picture by clarifying the big picture. “He applies the same homespun wisdom to everything: health care, the Middle East, taxes, terrorism,” Wheeler says of Trump. “I like the global-warming tweets because it’s fun to draw him in snow.”

This isn’t Wheeler’s first foray in drawing upon Trump’s political career for inspiration. One of his New Yorker cartoons pictured two guys at a political rally. One says: “With great ignorance comes great confidence.”

Wheeler’s mining of social media follows other cartoonists who have done the same. “Bill Plympton illustrated Kanye West’s [words] in a great book called ‘Through the Wire,’ ” Wheeler says of the Oscar-nominated animator. And “the New Yorker cartoons with Kanye’s tweets are classic,” he adds, referring to the 2010 mashup trend on social media.

Wheeler also nods to the original “S— My Dad Says” Twitter account by Justin Halpern that spawned books and the William Shatner sitcom. “I actually refused to use the title unless we had his blessing,” Wheeler says. “He DM’d me an okay. He is definitely getting a thanks in the book.”

Now that Wheeler has waded deep into Trump’s Twitterland, though, does he ever grow numb to the impact of the president’s words?

“Every day I’m shocked that I’m still shocked,” Wheeler says. “We’ll all be in trouble when we get used to this.”