Magazine images are so heavily retouched nowadays that the models hardly look human at all, with absurdly flawless skin and unrealistic body shapes that drive equally unrealistic expectations. It’s so unbelievable, and so potentially damaging to readers’ self-perception, that even the American Medical Association has condemned preposterous postproduction retouching.

Now a team of computer scientists has figured out how to quantify this retouching, using mathematical models to reverse the models’ body revisions. Hany Farid, a computer scientist at Dartmouth College, and PhD student Eric Kee developed algorithms that look for geometric changes, such as elongated necks, enlarged breasts or slimmed waistlines, and photometric changes, like de-wrinkled skin or (egads) removal of freckles.

To do this, Farid and Kee gathered 468 examples of before-and-after photos, including some that are anatomically impossible and others that are just hilarious. Among the selections is a skincare ad featuring the British model Twiggy, which was deemed so absurd it was banned in England, and a particularly infamous Ralph Lauren ad that shaved inches, and all sense of human organ proportion, from the waistline of model Filippa Hamilton.

(Farid’s website has a few more examples.) Then they found 390 human participants, recruited through Amazon’s Mechanical Turk service, and asked them to rank the level of alteration on a scale of 1 (very similar) to 5 (very different). Each worker was given 70 images. Then Farid and Kee developed eight sets of rules that embody the whole suite of photo retouching possibilities.

The algorithms aren’t perfect — the system over- or under-estimates the degree of alteration depending on certain factors that seem more or less important to a computer than a human. For instance, one before-and-after image shows a man with no front teeth who gets a Photoshopped set of pearly whites. The algorithms consider this a minor difference from a photometric and geometric perspective, but it certainly makes a huge difference in his appearance.

Still, it’s a good way to tell how much an image has been digitally altered, Farid and Kee say. They would like to see this system used to provide some perspective for readers of the big fashion glossies.

“Providing a rating of photo retouching alongside a published photo can inform the public of the extent to which photos have strayed from reality,” they write. “Although it remains to be seen if this rating can mediate the adverse effects of being inundated with unrealistic body images.”

The work is published in this week’s edition of the Proceedings of the National Academy of Sciences.