...Just encrypting the high level frequency coefficients serves to blur the image, but almost in an artistic way. The image contents are fully recognizable, but the details are pixelated or blurred. The general purpose of this program would be for securing images on the disk or in the cloud, available for searching but full resolution requiring a key to then access.
The high frequency coefficients are actually Huffman encoded. As such enough of them have to be spliced together in memory until a block is then available, encrypted, and then piece meal copied back in place.
Huffman encoding in jpg images uses control codes. ...