A collection of more than 14,000 photos spanning a century of Scottish life has been saved for the nation through a £1 million acquisition.
The MacKinnon collection includes photos dating from the 1840s through to the 1940s and covers subjects ranging from family portraits and working life to street scenes and landscapes.
It was acquired from a private collector following a special collaboration between the National Library of Scotland and the National Galleries of Scotland with support from the Scottish Government, the Heritage Lottery Fund and the Art Fund.
The collection was built up by photography enthusiast Murray MacKinnon, who established a chain of film-processing stores in the 1980s, starting from his pharmacy in Dyce, near Aberdeen.
Mr MacKinnon, who sold the collection to the private collector, said: "The collection covers the day-to-day lives of Scottish people both rich and poor, the work they carried out including fishing and farming, in order to survive, and their social life including sport and leisure.
"These were turbulent times what with industrialisation, shipbuilding, new forms of transport, the social upheaval caused by the First World War in Europe and the Boer War in South Africa. The discovery of penicillin and radiography heralded the development of medicine and the pharmaceutical industry in Scotland.
"I would like to thank all the people involved in acquiring this collection for the Scottish nation, and for their great efforts in making this acquisition possible."
Highlights of the collection include portraits of Scottish regiments from the Crimean War by Roger Fenton and more than 600 original photographs from the pioneering days of photography.
There are also albums and prints depicting life in the main towns and cities from the late 1800s and early 1900s and scenes of shipbuilding, railways, herring fishing, weaving, whisky distilling, dockyards, slate quarries and other working environments.
Dr John Scally, National Librarian, said: "This acquisition is akin to buying Scotland's photographic album of 14,000 pictures and bringing it home, and together with the National Galleries of Scotland, we were determined to make that happen.
"I am confident that every Scot will feel a connection with these wonderful photographs and we look forward to sharing them with the public over the coming months."
A major exhibition of the MacKinnon collection will be held at the Scottish National Portrait Gallery next year, with touring exhibitions around the country to follow.
The entire collection will also be digitised over the next three years and made available online.
Sir John Leighton, National Galleries of Scotland Director General, said: "This collection superbly demonstrates the important role Scotland had in shaping the history of photography.
"Our ability to tell this story is greatly enriched by this acquisition, and we look forward to the exciting partnership with the National Library of Scotland in making these artworks accessible to all."
The National Library of Scotland and National Galleries of Scotland each contributed £125,000 to the acquisition while £350,000 came from the Heritage Lottery Fund.
The Scottish Government provided £300,000 while £100,000 came from the Art Fund.
Culture Secretary Fiona Hyslop said: "The MacKinnon collection is one of the most remarkable collections of Scottish photography and an invaluable resource for researchers, students and the wider public."