They say a picture is worth a thousand words, but a selfie turned out to be priceless for one Texas man.

Cristopher "CJ" Precopia faced 99 years in prison for a violent crime he said he didn't commit -- and only a photo he took of himself was able to clear his name.

Precopia, 21, of Williamson County, said he was confused when police arrested him on Sept. 22, 2017. Officials said his ex-girlfriend, who was not named, claimed Precopia broke into her home, assaulted her and then slashed an “X” into her chest with a box cutter during a brutal Sept. 20 attack, KVUE reported.

Precopia said he couldn’t recall the last time he spoke to the woman, whom he dated in high school.

But he was placed behind bars at the Williamson County Jail and charged with burglary of a habitation with the intent to commit other crimes -- a felony that could have landed him life in prison, the Washington Post reported.

POPULAR CLEVELAND REPORTER, 30, KILLED BY UNCLE IN MURDER-SUICIDE, AUTHORITIES SAY

His parents posted the $150,000 bond and then set out on a mission to prove his innocence.

Cristopher's mother, Erin Precopia, remembered the evening of the alleged attack she was with her son at the Renaissance Austin Hotel. She also had proof – a selfie taken at 7:02 p.m. CST. The accuser told authorities she was attacked at 7:20 p.m. at her Bell County residence -- about 70 miles from the hotel where Precopia was with his mother.

Precopia’s lawyer, Rick Flores, told the Washington Post his client was lucky he had a “rock-solid alibi.”

“He was very fortunate that she chose a date and time that he just happened to have a rock-solid alibi for,” Flores said. “He and I have talked many times about how lucky he is, whether you believe in a higher power or good old-fashioned luck.”

On June 21, the charge was dropped after Flores provided the evidence to the district attorney’s office.

TEXAS GRANDMOTHER ALLEGEDLY ABANDONED GRANDCHILDREN IN HOUSE FIRE: REPORT

"We are always willing to listen and examine new information, and that's exactly what we did in this case,” Bell County District Attorney Henry Garza said.

Precopia's accuser has not been charged with a crime, KVUE reported.

Precopia told KVUE he is ready to move on and has applied to enlist in the Army.

"I'm ready to actually live my life, the way I want to, without having any kind of worry that this can come back and hurt me," he said.