Ian Rankin is set to take pride of place in the Scottish National Portrait Gallery after a painting of the Scots crime novelist was donated by Alexander McCall-Smith.

Ian Rankin is set to take pride of place in the Scottish National Portrait Gallery after a painting of the Scots crime novelist was donated by Alexander McCall-Smith.

McCall-Smith presented the portrait to the gallery after commissioning Edinburgh-based artist Guy Kinder to paint it in 2013.

Kinder's portrait depicts Rankin in a contemplative pose in the Oxford Bar, an Edinburgh pub famously frequented by himself and his fictional creation, Inspector Rebus.

The portrait will be added to a collection at the gallery that celebrates the achievements of Scotland's great literary figures, including Robert Burns and Sir Walter Scott.

Rankin, who was born in Fife, began writing books while working towards a PhD on modern Scottish fiction. His Rebus novels, the first of which was published in 1987, have been translated into 36 languages and are bestsellers across the world, winning him numerous awards, including four Crime Writers' Association Dagger Awards, America's Edgar Award, Denmark's Palle Rosenkrantz Prize and the French Grand Prix du Roman Noir.

Rankin said: "I've only been painted a few times in my life, usually as a caricature to accompany a newspaper review of one of my books, so it was slightly unnerving to see how well Guy Kinder had captured me. Of course, he found me in my natural habitat - the Oxford Bar - so I'm more at ease than in some situations. I like the painting a lot, but I do wonder what I was thinking at the time. Maybe my drink is just out of view..."

Alexander McCall Smith added: "It gives me the greatest possible pleasure to present this portrait to the Scottish National Portrait Gallery. I think that Guy Kinder has captured Rankin perfectly. Ian is a good and kind man and I think that this comes out in the portrait, while at the same time the artist has somehow managed to hint at the atmosphere of Ian's novels. The result, I think, is something of a triumph."

Christopher Baker, Director of the Scottish National Portrait Gallery said: "This is a very welcome addition to the national collection - a powerful portrait of one of Scotland's greatest contemporary writers by a highly skilled local artist. It is also a most generous gift to the Gallery from a friend of both the painter and the sitter."