The farm produces more than 70,000 piglets every year
A Scottish farm has secured a grant to harness the power of pig muck by turning it into electricity.
The company in East Lothian was given more than £500,000 to convert slurry and vegetable waste into energy.
The Ruchlaw Produce Company in Dunbar, which employs 45 people, is the first farm in south east Scotland to use the technology.
The waste is fed into an "anaerobic digester" to create methane and carbon dioxide.
This will then be pumped into a biogas plant to generate electricity and hot water for heating.
The digester should be able to produce 832MW of electricity and 629MWH of heat.
It will be formally unveiled by Rural Affairs Secretary Richard Lochhead this week.
He said: "Agriculture is well placed to help Scotland reduce harmful emissions and at the same time reap the benefits for farming businesses.
"Scotland has some of the most ambitious climate change legislation in the world and there has already been a great deal of innovation within the farming sector.
"Land use is estimated to contribute around 20% of Scotland's total emissions and the actions outlined in our plan will help agriculture thrive and create a healthier climate. A win-win solution for us all."
It is hoped about 2,000 tonnes of vegetable waste will be gathered by local councils and producers to be converted into "green" energy, reducing landfill waste.
Any extra waste generated from the new plant will be converted into fertiliser and excess fuel will be sold to the National Grid.
The company, set on 137 hectares, has 3,200 breeding sows which produce 70,000 pigs a year.
The £560,000 grant was secured from Rural Priorities, part of the Scotland Rural Development Programme.