Photo credit: National Trust for Scotland, House of Dun
The artist's name is down as John Gandy and it seems to me that this could be a mistake. There are two Gandy's that this might be by James Gandy (1619–1689), a portrait painter that may have worked with Van Dyck, or his son, William Gandy (d.1729).
If this painting is signed 'J. Gandy' then it might one of less than a handful of extant portraits by James Gandy. Is the portrait signed? The title suggests a date of 1690, which suggests it is signed and dated.
The National Trust for Scotland comments: 'I agree with Tim about the confusion of the name of the artist. Stylistically, the portrait belongs to the latter half of the 17th century so might suggest an attribution to William Gandy, the son:
Gandy, son of James Gandy, was probably born in Ireland. For some years he was an itinerant painter in Devon and the west of England. He went to Plymouth in 1714 and eventually settled in Exeter.
However, the attribution states "John Peter Gandy" and there is a "circle of Gandy" attached to the record so it may not be either of the Gandy family mentioned.'
Useful biographical details of James and William Gandy can be found here:
Unless there is an earlier individual sharing the same sequence of names, the attribution to John Peter Gandy (aka Sir John Peter Deering) is highly questionable, as he was an architect, living from 1787 - 1850, and was a member of the Royal Academy, submitting only architectural designs and drawings to that august institution. See the following for details:
Additionally, David Erskine, Lord Dun, was so created in 1710. He was born in 1670 and died in 1758. His brother, James Erskine was born in 1671 and died after 1745. See:
In 1690, James Erskine would have been 19 years old. This discussion's painting does not appear to be of a 19-year-old. It is most likely, therefore, that it does not depict the James Erskine mentioned in the work's title. By deduction, it is therefore also unlikely to have been painted by the James Gandy referenced by Tim Williams above, as James Erskine would have been 18 when James Gandy died in 1689.