When Rene Compean snapped a photo of his soot-stained legs hanging over a steep cascade of rocks, he feared it was the last picture he’d ever take. Hopelessly lost while hiking in Southern California, he thought he might die.

“I’m not ready,” the 45-year-old man told himself as he repeatedly yelled for help and used charred sticks to write SOS on any open surfaces he could find.

Compean had trekked through the Angeles National Forest trails more times than he could count, he said, but after venturing along a new path April 12 — for what he intended to be a two-hour outing — he lost his way.

Several hours into the solo hike, after many failed attempts at getting his bearings, he was scared. The temperature was dropping fast in the remote, rugged terrain, and the winds were whipping.

Compean grabbed his cellphone, which had less than 10% battery remaining, and climbed to a spot where he was able to get at least one bar of signal.

“SOS. My phone is going to die. I’m lost,” Compean texted a friend, along with two photos showing where he was — though only one went through. It was the picture of his legs.

The photo offered minimal information and, given Compean’s lack of cellphone signal, the resolution was very low. More importantly, though, Compean didn’t realize his location settings were disabled on his phone.

Still, the grainy image was somehow detailed enough for a total stranger to decipher the hiker’s exact location.

Ben Kuo was working at his home about 60 miles away in Ventura County, Calif., when he stumbled upon a tweet from the Los Angeles County Sheriff’s Department, along with the photo of Compean’s legs.

The sheriff’s search-and-rescue teams had already spent the previous night unsuccessfully looking for Compean, so they released the photograph to the public hoping someone could help.

The department tweeted: “Are You an Avid Hiker in the Mt. Waterman Area? #LASD SAR Teams need help locating a #missing hiker.”

Kuo, 47, inspected the image and thought, “I bet I could find that spot,” he recalled.

Kuo works in the tech industry, but he is also an amateur radio operator. For several years, as a hobby, he has used his Twitter account to alert the public about natural disasters. He regularly examines satellite imagery to identify and track local wildfires.

Plus, he has another unusual pastime: “I have always loved looking for where photos are taken,” Kuo said. He frequently tries to identify where movie scenes, television shows, or commercials were filmed. He’s often successful.

So when he came across the blurry image of Compean’s legs surrounded by an endless landscape of rocks and vegetation, he instinctively pulled up a satellite map. Because the sheriff’s department said Compean’s car was found near Buckhorn Campground, he narrowed his search to the surrounding area.

The first thing he noticed in the picture were patches of greenery. “I realized he’s got to be on the south side because there’s not really any green valleys on the north side,” he explained.

That finding helped him zero in on one area that closely resembled the terrain in the image. The final step was cross-referencing the original photo with Google Earth and comparing specific details.

“By punching in the time and date that the photo was taken, you can compare the view in Google Earth,” said Kuo. “They matched.”

He shared a screenshot of the satellite imagery on Twitter and called the sheriff’s department to notify officials of the coordinates he uncovered.

After vetting the findings in relation to the information they were able to glean about Compean’s whereabouts, the department dispatched a search-and-rescue team via helicopter to the area.

Rescuers found Compean less than a mile from Kuo’s predicted coordinates.

“It was very gratifying that he was saved,” Kuo said. “If you have information that could help save somebody, that’s something worth sharing.”

For Compean, who had spent more than 27 hours alone in the wilderness, hearing the vibrating helicopter hovering above him left him in tears. He was overwhelmed with relief, he said.

“I’m safe!” Compean, who sustained just a few minor cuts and scrapes, yelled repeatedly to no one in particular.

Compean’s story probably would have ended very differently, said Sgt. John Gilbert of the Los Angeles County Sheriff’s Department, had a total stranger with strong satellite skills and a sharp eye for detail not taken immediate action.

After his rescue, Compean, who works as a mechanic, thanked Kuo profusely on a Zoom call, saying, “I owe you my life.”

“I’m so lucky that Ben did what he did,” said Compean, who plans to meet soon with Kuo for a celebratory meal. “I’m thankful to be alive.”