A school teacher used computer technology to turn innocent photographs of pupils into pornographic images.
Vicar's son Jonathan Collard, 48, who has been jailed for two years, collected thousands of porn images of children on his computers.
Lewes Crown Court heard Collard blamed his lack of sexual experience with women for his obsession. However, he believed God had forgiven his behaviour.
Collard was arrested in December last year while working as head of geography at Great Walstead School in Lindfield, near Haywards Heath.
Collard, who resigned soon afterwards, was living in a caravan on the campus of the private day and boarding school, which teaches boys and girls between the ages of two and 13.
Collard, who was also head of house at the school where he had taught since 1976, admitted seven offences related to making indecent pictures by altering photographs taken by him of pupils.
He also admitted a further 17 charges related to possessing indecent photographs. He asked for 5,394 similar offences to be taken into consideration.
Judge Richard Brown told him: "Those who get involved in these evil and sordid activities have to realise prison awaits them if they get caught."
Collard was banned for life from working with children and was placed on the sex offenders' register for ten years.
He was also prohibited for life from using a computer to access the internet unless for work purposes.
Richard Cherrill, prosecuting, told the court the images were found on a desktop and two laptop computers in Collard's caravan.
Officers also found a number of handwritten indecent stories about young girls, plus a list of internet sites where pornographic images could be viewed.
Mr Cherrill said the police investigation found no evidence or suggestion that Collard had touched or interfered with children.
He said: "The defendant made images on the computer that consisted originally of photographs he had taken of pupils at the school. He had altered the images so the physique, posture and clothing of the children was altered to create indecent images."
He said Collard had also collected a vast quantity of disturbing material.
More than 100,000 images were discovered. A total of 30,000 were looked at by detectives and 5,000 indecent images of children found.
When Collard was arrested he confessed the pictures were for his own sexual gratification and described himself as deeply ashamed.
He recognised he had a problem and told officers he was concerned if he had not been arrested he might have turned to offending real girls instead of looking at images.
The pictures of pupils are believed to have been taken during the Eighties and Nineties and all have now left the school.
Sarah Thorne, defending, said Collard, who now lives in Kirby Avenue, Ripon, North Yorkshire, has no previous convictions and was appalled and ashamed of anything he had done to exploit the children in the images.
She said: "He is a man who had an untarnished reputation all of his life. He accepts he had a problem for a long time which escalated into an obsession."
Ms Thorne said: "He did not manage to have a full sexual relationship with anybody and his obsession developed because of his frustration."
She said Collard was a religious man: "He has fully confessed everything to his parents and most importantly, to God, and he is fully convinced he has been forgiven by God."
She said he was "glad" he was arrested and he has received counselling since he was remanded in custody in August.
After the hearing Detective Chief Inspector Graham Bartlett said the police believed that all the pupils whose photographs were taken by Collard and then altered had been contacted by officers and were aware of the case.
The school's registrar Jane Howard said: "We can confirm Mr Collard was a member of staff but as soon as we were aware of the investigation he was immediately suspended."
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules hereComments are closed on this article