The researchers used the computer program to analyse 43,950 photos, following recruitment of 166 users of a popular social media app, including 71 people that had a clinical diagnosis of depression.
The program scoured the photos for details that were associated with healthy and depressed individuals.
This was then used to see if the program could predict who would go on to be diagnosed with depression by only looking at photos that were posted before their diagnosis.
Dr Andrew Reece, study co-author from Harvard University, said: “Although we had a relatively small sample size, we were able to reliably observe differences in features of social media posts between depressed and non-depressed individuals.
“Importantly, we also demonstrate that the markers of depression can be observed in posts made prior to the person receiving a clinical diagnosis of depression.”
The team said further research using larger numbers of participants would be needed before a reliable early warning system could be used wide scale.
Future programmes would also need to overcome legal hurdles surrounding the privacy photographs and personal data.