“I had to explain that I’ve got enough political problems without you making me look like Napoleon,” Mr. Obama said. “You’ve got to bring it down just a touch.”

The former president also thanked Ms. Sherald “for so spectacularly capturing the grace and beauty and intelligence and charm and hotness of the woman that I love.”

Ms. Sherald, in her remarks, paid tribute to Mrs. Obama. “You exist in our minds and hearts in the way that you do because we can see ourselves in you,” she said. “What you represent to this country is an ideal — a human being with integrity, intellect, confidence and compassion. And the paintings I create aspire to express these attributes.”

Among the prominent figures who turned out for the ceremony were Steven Spielberg, the filmmaker, and his wife, the actress Kate Capshaw, who helped fund the commission of the portraits. Also in attendance were several former members of Mr. Obama’s administration, including Eric H. Holder Jr., the former attorney general; David Axelrod, the former senior strategist; Jay Carney, the former press secretary; and Sam Kass, Mr. Obama’s senior policy adviser for nutrition (who sat with his baby in his arms). “We miss you guys,” Mr. Obama told them, in his remarks.

Mr. Wiley’s work often features African-Americans in the regal poses of emperors and kings, his own distinctive riff on historic portraiture. The Obama portrait, too, has its own majesty. But the former president is also depicted in a chair, with his hands crossed and elbows on his knees — a posture of informality and intimacy.

The two men paged through Mr. Wiley’s collection of art history books and thought about “the grand tradition of presidential portraits,” Mr. Wiley said, in an interview after the unveiling. “Then we decided very quickly that we were just going to strike out a path of our own and try to create a type of singular narrative surrounding what this picture looks like — discarding history but also embracing it at once.”