The court heard that Brooks and the woman had been friends at high school and remained in contact on social media.

Prior to the crime, the first offender obtained a software application which altered images using AI.

Prosecutor Katie Malcolm said: “Brooks took two images from the woman’s Instagram account which she uploaded online in which she was fully clothed.

“Brooks then altered the images so that they showed the woman to be in a state of undress.

“One was a full length image and the other was from the waist up.

“Brooks then sent the images to two friends.”

The hearing was told that the woman “knew nothing” about the images.

In February last year she was asked by one of Brooks’ friends about her knowledge of the images, which were shown to her.

Ms Malcolm added: “She was immediately embarrassed and humiliated.

“She confirmed that the images were lifelike and the matter was reported to the police.”

Brooks was arrested and told officers: “It was really just pettiness on the part of people – I know I shouldn’t have done that, I shouldn’t have done Photoshop.”

He said that one of his friends requested the images while the other did not.

Brooks said that he carried out the crime to show what the software did.

Gerry Devaney, defending, told the court that Brooks fell out with one of his friends after the images had been sent.