IEEE 7th International Conference on Smart Structures and Systems ICSSS 2020
An Encryption-then-Compression Scheme Using
Autoencoder Based Image Compression for Color
Images
Sreelakshmi K. Renjith V. Ravi
Electronics and Communication Engineering Electronics and Communication Engineering
MEA Engineering College MEA Engineering College
Malappuram, Kerala, India. Malappuram, Kerala, India.
sreelakshmik811@gmail.com renjithravi.research@gmail.com
Abstract—The goal of this work is to develop an encryption and Several studies have been reported on the encryption and
then compression scheme for the efficient transmission of color then compression of images. In [1], a block scrambling tech-
images over an untrusted channel. An image encryption scheme nique is used to encrypt the color images and then compressed
based on bidirectional diffusion is used to encrypt the 8-bit
RGB color image. Then, lossless, autocoder-based compression of it using JPEG standard. In [2], bidirectional diffusion and
the encrypted image is performed to achieve compression. The the compression are introduced. In [3], Haar and Daubechies
compression method is used to reduce the size of the images wavelet based compression techniques are presented. The im-
during transmission, thus speeding up the transmission. The ages are encrypted using random permutation method. In [4],
performance of the compression algorithm is evaluated in terms Asymmetric Numeral Method (ANM) technique is introduced
of the compression ratio.
Index Terms—autoencoder,compression,bidirectional diffu- for compressing and then used an image prediction system to
sion,image encryption,image decryption,security. encrypt images. In [5], prediction error clustering and random
permutation is the technique used for image encryption and
I. I NTRODUCTION then efficiently compressed the encrypted image by a context-
In the present scenario, the transmission of images and adaptive arithmetic coding approach. In [6], the encryption of
videos plays an important role in communication. It is impor- image has done by random error and clustering and the en-
tant to ensure this transmission to be safe. For this purpose, crypted data has been compressed using arithmetic coding. In
images must be encrypted if they are converted into an un- [7], image encryption was accomplished by random permuta-
readable form before transmission. This makes it difficult for tion and subsequently the secure encrypted image compression
a third party to recover it. At the receiving end, the decryption was performed using an image compression algorithm based
operation is performed to restore the original image. This is the on Haar and Coif-let wavelets.
aim of the technique known as image cryptography. However, The primary goal of this paper is to introduce a bidi-
it takes a very long time to complete the transmission, unless rectional diffusion based encryption and auto encoder based
it is compressed. Compressing these encrypted images also compression scheme to accomplish high security compared
helps to reduce storage space. with the prevailing schemes. The technique of spreading the
The Secure image compression is categorized into information in an image is used to increase the security of
two types: compression-then-encryption and encryption-then- block permuted image encryption scheme. Further, compres-
compression. The compression process is initially performed sion of the encrypted image using auto-encoder based image
in compression-then the encryption process, and the com- compression scheme is also described in this work.
pressed data is later encrypted. Likewise, the encryption pro- An overview of the work can be seen as, Section II gives
cess is carried out in encryption-then-compression first, and the methodology of encryption process. Experimental results
after the encrypted data will be compressed. The introduction including the performance analysis of this encryption-then-
of compression technology encryption is an interesting propo- compression scheme is given in the Section III.Finally, Section
sition that could lead to a hybrid combination of compression IV concludes the article.
and security. The key challenge is to build stable compressed
data without degrading the image quality. II. METHODOLOGY
The encryption-then-compression scheme presented here
Kerala State Council for Science, Technology and Environment for finan-
cially supporting this work under the student project funding scheme with consists of bidirectional diffusion-based image encryption and
reference No. 00475/SPS 64/2019/KSCSTE. auto-encoder based compression to compress the encrypted
978-1-7281-7223-1/20/$31.00©2020 IEEE
Authorized licensed use limited to: Carleton University. Downloaded on November 03,2020 at 18:31:57 UTC from IEEE Xplore. Restrictions apply.
IEEE 7th International Conference on Smart Structures and Systems ICSSS 2020
image. Furthermore, the compression performance is analysed Horizontal
in terms of compression ratio. Inversion
A. Encryption-then-Compression Scheme
Encryption is a technique that makes visual identification
of images difficult. It is important to meet the low processing
Vertical
demands and signal processing along with the assurance of Inversion
security. To handle this problem, encryption-then-compression
[8] systems are introduced. The images encrypted are com-
pressed using a compression algorithm before transmitting
through the channel. Compression reduces the number of
bits needed to represent each pixel values of the images
considered. The schematic representation of an encryption-
then-compression system is given in Figure.1 (a) Block inversion
Input Color
Encryption Compression
Image
Decrypted 90 Degree 270 Degree
Decryption Decompression
Color Image
Fig. 1: Block schematic of encryption-then-compression sys-
tem.
180 Degree
B. Encryption
The procedure for bidirectional diffusion based image en- (b) Block rotation
cryption [1], [2], [9] used in this work can be described as
Fig. 3: Example for block rotation and inversion
follows Fig. 2. Here, an 8 bit RGB color image is the input
to encryption system.
Step4: Perform block rotation process [1]. Blocks can be
Splitting RGB Block Block Block
randomly rotated based on the secret key K2 . Rotation of
Input Color Channels &
Dividing
Scrambling Rotation Inversion blocks of the image by 90° , 180°, 270° and 360°.
Image (IRGB )
into Step 5: Perform block inversion [1]using the key K3 . Blocks
8 x 8 Blocks
K1 K2 K3 can be either be horizontally or vertically inverted randomly
as shown in Fig. 3.
SHA 256 Based Key Genration
Step 6: The pixel values of the image are reversed based
K6 K5 K4
on the randomly assigned integers to each block [1]. These
Encrypted
integers are generated based on the secret key K4 . The process
Reverse Forward -ve to +ve
Image (IE ) Diffusion Diffusion
Integration
Transormation is termed as negative to positive transformation.
Step 7: Apply the process of bidirectional diffusion [2] to the
resultant image obtained from step 6. This process is intended
Fig. 2: Block diagram of image encryption [9] to hide the information contained in the image. The XOR
operation is the technique used for achieving the diffusion.
Step 1: Split the R,G and B components of the color image The Equation (1) represents the forward diffusion operation
IRGB of size X × Y and padded the R,G and B components and the corresponding key stream. Here, for i = 1, 2, ...., mn,
horizontally to get an image of size 3 × X × Y , which is input the values of elements of the image are modified sequentially
to encryption system. from left to right and from top to bottom.
Step 2: Select Bx × By = 8 as the block size.
Bi = Bi−1 ⊕ K5i ⊕ Ni (1)
Step 3: Perform block scrambling operation [1]. In this pro-
cess, blocks of the image are randomly permuted based on a where Bi denotes the value of ith element after the forward
secret key K1 . diffusion, K5 is the first key stream used in the diffusion pro-
978-1-7281-7223-1/20/$31.00©2020 IEEE
Authorized licensed use limited to: Carleton University. Downloaded on November 03,2020 at 18:31:57 UTC from IEEE Xplore. Restrictions apply.
IEEE 7th International Conference on Smart Structures and Systems ICSSS 2020
cess, Ni is the ith element of negative to positive transformed
image obtained from step 5. The Equation (2) represent the
generation of key K5 .
K5 = [f loor(v1 × 1016 )]mod2β (2)
where v1 is the is a chaotic sequence with length mn generated
by chaotic system with control parameter r, initial state value
z(1), sampling distance d1 , β is a positive integer.
In the second stage, each element of B obtained from
forward diffusion will undergo reverse diffusion process. This
process is defined by the Equation (3). Here for i = mn, mn−
1, ......1, the sequential modifications from right to left and
from bottom to top are carried out.
Ci = Ci+1 ⊕ K6i ⊕ Bi (3)
where Ci denotes the ith element after the reverse diffusion,
Fig. 4: Auto-encoder Network
K6 is the second key stream, Bi is the ith element of image
obtained after forward diffusion. The key K6 is obtained from
the Equation (4).
The unsupervised learning of the auto-encoder is carried
K6 = [f loor(v2 × 1016 )]mod2β (4) out for the purpose of compression [8]. Fig. 5 represents the
architecture of the auto-encoder. This architecture consists of
where v2 is a chaotic sequence with length mn generated by three layers such as input layer, hidden layer and the output
chaotic system with same control parameter r, the same initial layer. The number of neurons at the input and output layers
state value z and different sampling distance d2 , and a positive are equal to the number of pixels in the input image. From
integer β. After completing all these processes, the encrypted the Fig. hj is the compressed image obtained at the hidden
image IE will be obtained. layer. x1 ,x2 ,...xN are the input which are values of pixels in
C. Key Generation the input image. The operation of neural network for encoding
are given by the Equation 6,
There are four keys in which each one is used for block
scrambling, block rotation, block inversion and negative- N
X
positive transformation. These keys are generated based on hj = Wji xi (5)
Secure Hash Algorithm(SHA) [10]. Here SHA-256 is used i=1
for this purpose. The same keys are generated at the receiver
where Wji is the weights multiplied to the pixel values.
side for the reverse operations of steps carried out during the
For decompression, the equation can be used and 0 N 0 is the
encryption process. SHA-256 is a one way function which
dimension of the input image.
converts text of any length into string of 256 bits.
K
D. Compression and Decompression
X
x0j = 0
Wji hj (6)
A digital image is stored as a set of pixels with values of j=1
rows and columns. In real-world scenarios, the images require
huge amounts of memory. Image compression is required where x0j is the decompressed image obtained at the output
to manage the storage space and save image transmission layer of auto-encoder and 1 ≤ j ≤ K and ’K’ is the number
time. There are various image compression techniques that of neurons at the hidden layer. The decompressed image will
can be either lossy or lossless and are used today for this be decrypted subsequently for recovering the original image.
purpose. Lossy image compression discards the partial in-
E. Decryption
formation content in images and is therefore an irreversible
compression (example; JPEG). Lossless image compression The reconstruction of original image are carried out at
allows to perfectly reconstruct images from the compressed the receiver side using decryption procedure [11], [9]. The
image (example;Huffman encoding, JPEG 2000 etc.) decryption algorithm consists of step by step inverse processes
In the encryption-then-compression scheme discussed here, of encryption in the reverse order. The input to the decryption
the image encrypted with the bidirectional diffusion algorithm algorithm is the encrypted image of size 3 × X × Y . Fig. 5
is compressed with a lossless, autocoder-based image com- shows the block diagram of decryption process. The steps
pression scheme before transmission. An auto-encoder, which included in diffusion procedure are following.
is a neural network used to reduce dimensionality, compressing Step 1: Perform the inverse operation of the reverse diffusion
the data in the image to less and preserving as much of the process [2] for for i = mn, mn − 1,......,1, using secret keys
important information as possible. r, z and d2 , and is calculated using the Equation (7) given
978-1-7281-7223-1/20/$31.00©2020 IEEE
Authorized licensed use limited to: Carleton University. Downloaded on November 03,2020 at 18:31:57 UTC from IEEE Xplore. Restrictions apply.
IEEE 7th International Conference on Smart Structures and Systems ICSSS 2020
below. B 0 i is the ith element of reconstructed image, after the
forward diffusion in encryption procedure.
Bi0 = Ci0 ⊕ Ci+1
0
⊕ K6i (7)
Next,the inverse of forward diffusion is carried out or i =
1, 2, .....mn, by using secret keys r, z, and d1 . It is calculated
sequentially by using the Equation (8) given below.
Ni0 = Bi0 ⊕ Bi−1
0
⊕ K5i (8)
Step 3 : Split the image obtained from step 2 into blocks of size
Bx = By = 8. Apply inverse negative-positive transformation
(a) Original image
[1] to each block using the random integer generated using
key K4 .
Step 4 : Perform inverse operation of block inversion [1] using
the key K3 .
Step 5 : Apply the inverse operation of block rotation [1] using
the key K2 .
Step 6: Here, the blocks of scrambled image of size 3×X ×Y ,
is obtained as a result of performing Step 3, and are assembled
(b) Compressed image
in the correct order using the key K1 [1].
Step 7 : Separate the image and integrate the separate channels
of R, G, and B to obtain the decrypted image shown in Fig.5.
Encrypted Inverse Inverse Dividing Inverse
Reverse Forward into -ve to +ve
Image (IE ) Diffusion Diffusion 8x8 blocks Transformation
K6 K5 K4
Inverse
SHA 256 Based Key Genration block
K3
Inversion
K1
K2
Decrypted (c) Decompressed and decrypted image
Color Image Inverse
Image Block
Integration Block
(IRGB ) Separation Assembling
Rotation Fig. 6: Results of encryption-the compression scheme consid-
ering Lena image
Fig. 5: Block diagram of image decryption [9]
A. Compression Ratio
It is defined as the ratio of size of original image and
III. RESULTS AND DISCUSSION compressed image.
The evaluation of encryption-then-compression scheme are Original Image Size
CompressionRatio = (9)
done considering some of the standard test images. Compressed ImageSize
The Peak Signal-to-Noise Ratio (PSNR), Mean Square Er- On evaluating the compression performance of auto-encoder
ror(MSE) and Structural Similarity Index(SSIM) between orig- based image compression scheme, the obtained compression
inal image and decrypted image are calculated for measuring ratio between uncompressed image and the compressed image
the errors in encryption-then-compression scheme introduced is 1.536. This results of the compression ratio proves that
here. Considering Lena color image of size 512 × 512, proved lossless compression scheme used is of higher performance.
the performance of encryption-then-compression scheme is The obtained results of compression ratio between the
high. The PSNR value between the actual image and decrypted uncompressed image and compressed image considering Lena
image are obtained as + ve infinity. Also MSE as zero and color image of size 512 × 512 are compared with some recent
SSIM as 1 are obtained. works in the literature. The results are tabulated in Table.I.
978-1-7281-7223-1/20/$31.00©2020 IEEE
Authorized licensed use limited to: Carleton University. Downloaded on November 03,2020 at 18:31:57 UTC from IEEE Xplore. Restrictions apply.
IEEE 7th International Conference on Smart Structures and Systems ICSSS 2020
This comparison enables to infer that the auto-encoder based terms of PSNR, MSE and SSIM, the results proved the
image compression scheme used is of higher performance. correctness of the encryption scheme.
TABLE I: Results Compression Ratio for test image Lena ACKNOWLEDGMENT
Reference Compression Ration
The authors acknowledged to Kerala State Council for Sci-
[12] 0.42 ence, Technology and Environment for financially supporting
[11] 1.41 this work under the student project funding scheme reference
Proposed 1.536 No. 00475/SPS 64/2019/KSCSTE.
R EFERENCES
B. Advantages [1] T. Chuman, W. Sirichotedumrong, and H. Kiya, “Encryption-then-
compression systems using grayscale-based image encryption for jpeg
The encryption-then-compression scheme for color images images,” IEEE Transactions on Information Forensics and security,
described here offers several advantages in he area of image vol. 14, no. 6, pp. 1515–1525, 2018.
cryptography. [2] L. Li, G. Wen, Z. Wang, and Y.-X. Yang, “Efficient and secure image
communication system based on compressed sensing for iot monitoring
• High Security: It allows highly secure transmission of applications,” IEEE Transactions on Multimedia, 2019.
images through the channel which are probably untrusted [3] H. K. Aujla and R. Sharma, “Designing an efficient image encryption-
then compression system with haar and daubechies wavelet,” Inter-
and watched by eavesdroppers. This security in ensured national Journal of Computer Science and Information Technologies,
by selecting the small block size in the encryption algo- vol. 5, no. 6, pp. 7784–7788, 2014.
rithm as ‘8 × 8’ smallest. There are mainly three factors [4] P.Sridevi and D. J. Suguna, “An efficient encryption-then-
compressionsystem using asymmetric numeral method,” International
Small Block Size, Larger Number of Blocks and Key Journal of Engineering and Technology, vol. 9, no. 5, pp. 3680–3688,
Space Expansion as mentioned in [9] which enables the Oct. 2017.
scheme to be highly secure for image transmission. Also [5] C. Joseph, J. Davies, and V. Paul, “A survey of encryption then com-
pression using auxillary information,” International Journal of Science,
the choice of small block size leads to large number of Engineering and Computer Technology, vol. 6, no. 1, p. 40, 2016.
blocks which makes difficult to reconstruct the original [6] R. Kaur and S. Kaur, “An image encryption-then-compression using
image from the encrypted one. clustering andpermutation,” International Research Journal of Engineer-
ing and Technology, vol. 5, no. 7, pp. 1518–1523, Jul. 2018.
• Robust: The spreading of pixel values by the process of [7] S. Devi and A. Gautam, “Designing of an efficient image encryption-
bidirectional diffusion enables the scheme to be robust to compression system using a newhaar and coiflet with daubchies and
several attacks like jigsaw puzzle solver attack. symlet wavelet transforms,” International Journal of Engineering Re-
search and General Science, vol. 4, no. 2, pp. 246–251, Mar. 2016.
• Compression Performance: The choice of a lossless auto- [8] J. Jiang, “Image compression with neural networks–a survey,” Signal
encoder based image compression scheme after encrypt- processing: image Communication, vol. 14, no. 9, pp. 737–760, 1999.
ing the original image provide perfect reconstruction of [9] K. Sreelakshmi and R. V. Ravi, “A bidirectional diffusion based image
encryption scheme for color images,” unpublished.
at the receiver side. Also the compression scheme offer [10] A. W. Appel, “Verification of a cryptographic primitive: Sha-256,”
a better compression rate which helps to save the storage ACM Transactions on Programming Languages and Systems (TOPLAS),
space. vol. 37, no. 2, pp. 1–31, 2015.
[11] M. Kumar and A. Vaish, “An efficient compression of encrypted images
using wdr coding,” in Proceedings of Fifth International Conference on
C. Applications Soft Computing for Problem Solving. Springer, 2016, pp. 729–741.
This encryption-then-compression scheme helps to provide [12] X. Peng, J. Hou, L. Tan, J. Chen, J. Jiang, and X. Guo, “Bit-error
aware lossless color image compression,” in 2019 IEEE International
a best solution to ensure security during the transmission of Conference on Electro Information Technology (EIT). IEEE, 2019, pp.
images through a channel provided by an untrusted channel 126–131.
provider. (Eg; social network service provider). This scheme
is applicable to Twitter, Facebook, Google photos etc.
IV. C ONCLUSION
A bidirectional diffusion based image encryption-then-
compression scheme was discussed here and has got superior
features over other existing schemes. The scheme offers en-
hanced security while transmitting images over an untrusted
channel. The images encrypted according to this scheme
includes larger number of small blocks.This offers the scheme
suitable for highly secure image transmission. This encryption-
then-compression scheme is robust to several attacks like
jigsaw puzzle solver attacks. Because of the spreading of pixel
values in the encryption procedure makes, the assembling of
information very difficult for a party. The analysis of the
compression performance of the scheme offered good results.
On analysing the performance of the encryption scheme in
978-1-7281-7223-1/20/$31.00©2020 IEEE
Authorized licensed use limited to: Carleton University. Downloaded on November 03,2020 at 18:31:57 UTC from IEEE Xplore. Restrictions apply.