NYPD cops fed up with vagrants making life miserable in the city are taking matters into their own hands — by snapping photos of quality-of-life scofflaws and posting them online.

The Sergeants Benevolent Association is spearheading the effort, emailing a letter to members Monday urging them and their families and friends to take pictures to document the decline of the city.

“As you travel about the city of New York, please utilize your smartphones to photograph the homeless lying in our streets, aggressive panhandlers, people urinating in public or engaging in open-air drug activity, and quality-of-life offenses of every type,” says the letter from SBA President Ed Mullins, a major critic of Mayor Bill de Blasio.

The union then “will notify our public officials in writing of what is being observed,” he said.

“We will refer issues to the proper agencies, and we will help create accountability across the board.”

The first set of snapshots uploaded to the SBA’s account on the photo-sharing site Flickr shows a raggedy panhandler approaching cars stopped at a red light, someone sleeping on pizza boxes outside a park and several people slumped on sidewalks with cups and signs begging for handouts.

Similar shots have recently appeared in The Post — including a Page 1 photo of a man relieving himself on an Upper West Side street — as complaints have surged about vagrants camping out on sidewalks and taking over parks.

Noting that more cops are being recorded on the job, Mullins wrote, “Shouldn’t accountability go both ways?”

“We, the ‘Good Guys,’ are sworn to protect our citizens. Shouldn’t our public officials be held to the same standard?” he said.

In his letter, Mullins notes that while cops are prohibited from taking pictures of members of the public while on duty, “photos may be taken while traveling to and from work or any time off duty.”

“Our friends, family and members of the public are free to take photos as they see fit,” he adds.

Mullins said he was responding to the past two years of “failed policies, more homeless encampments on city streets, a 10 percent increase in homicides, and the diminishing of our hard-earned and well-deserved public perception of the safest large city in America.”

He blasted the flurry of pending City Council legislation involving the NYPD, including the Right to Know Act, which would require cops to get permission from a suspect before conducting a search without probable cause for arrest.

“Amazingly, no one seems to give any thought about an officer fighting for their life or pulling a deranged and dangerous person off an innocent crime victim,” Mullins wrote.

“Attempts to pass self-promoting agendas are not the answer to building relationships with communities who don’t trust the police. It only serves to lie to people who are trying to live life and share in a piece of the American Dream.”

Photos for the SBA’s Peek-a-Boo, We See You! initiative can be emailed to peekaboo@sbanyc.org.