Paul Tingle then admitted to a string of offences thanks to the incriminating snap taken on the doorstep of the house on Bradford Road, Otley.
Leeds Crown Court heard Tingle knocked on the door of the house on the morning of May 23 this year but the owner of the property did not answer the door.
Tingle then looked through the window and was seen by the home owner.
Chloe Hudson, prosecuting, said: “When the defendant saw him through the window his face dropped and he looked alarmed to realise someone was still in the house.”
Miss Hudson said the home owner sprang up from his chair and went to confront Tingle.
She added: “The defendant was shocked and spluttering his words.”
Tingle then began to walk backwards off the property but the homeowner managed to use his phone to take a picture of his face.
He then contacted a police officer and the two of them went to see if they could find Tingle in the area.
They spotted him as he was trying the door of a property on Westbank Lane.
Tingle’s home was searched and property stolen in a break-in at a house on May 6, on Leeds Road, Dewsbury, was also recovered.
Tingle, of Bridge Street, Morley, pleaded guilty to burglary and two offences of attempted burglary.
He asked the court to take nine further offences of burglary and attempted burglary into consideration by the court.
The court heard Tingle has previously served seven prison sentences - totalling more than 20 years - for burglary offences.
Michael Walsh, mitigating, said Tingle’s offending was linked to his long-standing addiction to heroin.
He said Tingle had been making good progress since being released from prison on licence from his last sentence and had been working towards getting a job in the construction industry.
Mr Walsh said Tingle carried out the offences after he missed his appointment at the chemist to collect medication which helps him stay free of the drug.
He urged Recorder Gurdial Singh to take an exceptional course by not sending him straight to prison.
Tingle was jailed for four years. Recorder Singh said: “You are 46 and you have decided to pursue an occupation as a professional burglar.
“It was a choice that you made, and that is to enter people’s homes and steal what you can.
“People are entitled to security and sanctuary of their own homes and are entitled to feel safe.”
Detective Inspector Neil Thompson, of Leeds District Crime Team, said: “Tingle is a prolific burglar whose offending over the years has brought misery to a significant number of people who have had to suffer the indignity of having their homes invaded and their property stolen.
“His imprisonment is excellent news for local communities as he would undoubtedly still be committing further offences had he had not been caught.
“We would like to applaud the quick-thinking actions of the member of the public who had the presence of mind to take a photo of Tingle on his phone, and also recognise the good work of the off-duty officer who responded quickly to those concerns and arrested him after a search of the area.”