Chapter 2 Review of Related Works and Standards
2.5. Review of PNG Standard
2.5.2 Properties of PNG Images
Each PNG image consists of several ‘chunks’ substantially. In other words, with the exception of the first 8 bytes in each file, a PNG image comprises nothing but chunks. In the PNG format, two categories of chunks are included. One is named critical chunk which is a group of chunks that a decoder must be able to interpret in order to read and render a PNG file. This group consists of 4 chunks which are IHDR, IDAT, IEND, and PLTE. After the introduction to these critical chunks, we will introduce the other group of chunks, named ancillary chunk.
In general, a PNG image is at least composed with three types of chunks: IHDR, IDAT, and IEND. The IHDR is the image header chunk; the IDAT is the image data chunk; the IEND is the end-of-image chunk. An IHDR must be the first chunk in a chunks; if so, they all appear consecutively with no intermediate chunks. Each IDAT contains at most two gigabytes of compressed data. An IEND is the simplest chunk. It points out the end of a PNG image, and it contains no data. The previously-mentioned
three chunks can make up a PNG image, with or without an alpha channel. But if it is an image with a palette, it should contain another type of chunk, PLTE, the palette chunk. A PLTE has 256 palette entries and each entry is a 24-bits color in the RGB color space.
As we mentioned previously, the IHDR consists of the color information of the image which is named ColorType. If the ColorType equals 0, the image type is gray-level; if the ColorType equals 2, the image type is truecolor without an alpha channel; if the ColorType equals 3, the image type is indexed-color, with a palette; if the ColorType equals 4, the image type is gray-level with an alpha channel; if ColorType equals 6, the image type is truecolor with an alpha channel.
The ancillary chunks are also defined in the International Standard. They are not always necessary for constructing a PNG image. Therefore, these chunks may be ignored by decoders. There are 14 ancillary chunks, and we can classify them into 5 types according to their actions. The first type is about “transparency information”
which includes tRNS chunk; the second type is about “color space information”
which includes cHRM, gAMA, iCCP, sBIT, and sRGB chunks; the third type is about
“textual information” which includes iTXt, tEXt, and zTXt chunks; the forth type is about “miscellaneous information” which includes bKGD, hIST, pHYs chunks, and the last type is about “time information” which only includes the tIME chunk.
Chapter 3
Authentication of PNG Images by Adjusting Selected Pixel Values in Spatial Domain and Its Application to Data Hiding
3.1 Introduction
With more convenience and faster speed on the Internet, exchanges of images are more frequent in recent years. Especially, after the type of PNG image was created for data transferring on the Internet, its uses also become common. Development of the data hiding techniques for PNG images becomes necessary and very important.
In this chapter, we describe the proposed method for authentication of PNG images and its application to data hiding. In Section 3.1.1, several related definitions will be given. In Section 3.1.2, the rough idea of the proposed authentication method for PNG images will be described. The process of embedding authentication signals and the extraction process will be given in Section 3.2. In additional, the proposed data hiding technique which is based on the above-mentioned authentication method is described in Section 3.3. Finally, some experimental results are shown in Section 3.4, and some discussions and summaries are given in Section 3.5.
3.1.1 Problem Definition
Although copyright protection becomes a hot topic recently, most of the existing techniques for this purpose were developed only for some very common file formats which have been used for a long time, such as BMP and JPEG. Due to the
characteristics of the alpha channel, the PNG becomes a popular format in the Internet recently. However proposed data hiding methods for PNG images so far are very rare.
Most of the authentication methods embed authentication signals as a kind of secret data in cover images. The authentication signals and the secret data usually cannot be hidden at the same place. In other words, if we want to hide secret data and authentication signals in the same cover image, the data hiding capacity of the cover image must be bigger than the sum of the capacity of authentication signals and the capacity of secret data. In this study, we will propose a method which can combine the authentication signals and the secret data.
3.1.2 Proposed Ideas
In this section, we briefly describe the proposed method. At first, we divide the cover image into non-overlapping 3×3 blocks, and we select randomly a fixed number of values from the data of the four channels (red, green, blue, and alpha) of each block.
In each block, we add the selected pixel values up to get a sum. Also, we select a random number for use as a divisor. So, in each block, we have a sum and a divisor.
Then, we divide the sum by the divisor to get a remainder. Afterward, we adjust, by adding or subtracting, the previously-selected pixel values in each block to change the remainder to be 0. In this way, the final content of the block is regarded as a kind of authentication signal for use in image authentication.
In addition, we propose a data hiding method which is based on the above-mentioned authentication method. In the previous discussion, we mentioned that we pick up several values in a block. We use these selected pixel values to hide data. First, we count the number of odd numbers and that of even numbers in the selected pixel values in each block. And according to the data which are to be hidden, we adjust these numbers of odd numbers and even numbers to achieve the goal of
hiding data. More details are described in the following sections.
3.2 Proposed Image Authentication And Data Hiding Methods
In this section, the processes for the proposed image authentication method will be described. In Section 3.2.1, the process of embedding authentication signals will be described. In Section 3.2.2, the process of image authentication will be given. And in Section 3.3, the proposed data hiding scheme which is based on the proposed image authentication method will be described.
3.2.1 Authentication Signal Embedding Process
In order to protect the copyright of a PNG image, we propose an image authentication method to achieve the goal. The PNG format includes four channels which are red, green, blue, and alpha channels. In the proposed method, first we divide the cover image into non-overlapping 3×3 blocks. Also, because conceptually we may regard each of the four channels of a PNG image block as a 3×3 gray-level image, we combine the four channels to form a 6×6 gray-level image with 36 pixels, as shown in Fig. 3.1.
Next, we choose two keys to generate two series of distinct random numbers, denoted as Np and Nd, respectively, for each block. The series Np includes distinct numbers in the range of 0 to 35, representing the positions of the pixels in the 6×6 gray-level image mentioned above as shown in Figure 3.1. Also, each number in the series Nd is regarded as a divisor limited to be within the range from 3 to 18.
0 1 2
Fig. 3.1 Combination of four channels of an image block into a larger 6×6 gray-level image and the assigned positions of the 36 pixels. (a) Red channel (b) Green channel (c) Blue channel (d) Alpha channel
Then, for each 3×3 image block, we select randomly 18 pixel values according to Np from the corresponding 6×6 gray-level image and add them up to get a sum, and we divide it by a divisor selected randomly according to Nd to get a remainder. Then we apply a value adjustment process to adjust the selected pixel values to make the corresponding remainder to become 0. In this way, we can get a protected image with authentication signals embedded in the final adjusted image block values.
The details of such authentication signal creation and embedding is described as an algorithm below.
Algorithm 3.1. Authentication signal creation and embedding for a PNG image.
Input: a cover image I in PNG format, two secret keys p and d, and a random number generator f.
Output: a protected image Ip with authentication signals.
Steps.
1. Divide I into non-overlapping 3×3 blocks.
2. Use the two keys, g and h, as seeds for f to generate two series of distinct random numbers, Np and Nd, where the range of Np is limited to be between 0 and 35, and that of Nd is limited to be between 3 and 18.
3. For each 3×3 image block B, perform the following steps.
3.1. Compose a 6×6 gray-level image B′ with 36 pixels using the gray-level image planes of the three color channels and the alpha channel of B (as illustrated by Fig. 3.1).
3.2. Pick up in order 18 values from Np and regard them to represent the positions of 18 randomly selected pixels of B′.
3.3. Add up the gray values of the pixels of B′ located at the 18 positions to get a sum S.
3.4. Divide S by a divisor d selected in order from Nd to get a remainder r.
3.5. Apply the following value adjustment process to change the values of the 18 selected pixels of B′.
a. When r ≥ d/2:
i. if the values of the selected pixels are not all equal to 255, then increase the values of those selected pixels whose values are not equal to 255, each time by one, until the re-computed remainder r becomes equal to d; or
ii. if the values of the selected pixels are all equal to 255, then decrease the values of those selected pixels, each time by one, until the re-computed remainder r, becomes equal to 0.
b. When r < d/2 and r ≠ 0:
i. if the values of the selected pixels are not all equal to 0, then decrease the values of those selected pixels whose values are not equal to 0, each time by one, until the re-computed remainder r becomes equal to 0; or
ii. if the values of the selected pixels are all equal to 0, then increase the values of those selected pixels, each time by one, until the re-computed remainder r becomes equal to d.
c. When r = 0:
do nothing.
4. Take the resulting image as the desire protected image Ip with the adjusted pixel values in B′ being regarded as authentication signals.
In Step 3.5 above, we increase or decrease in order the 18 selected pixel values of B′, each time by one. Sometimes, the selected pixel value in each block can not be increased or decreased, because we can not decrease 0 to be negative and we can not increase 255 to be larger, either. Therefore, if the first round of value increasing or decreasing can not make the re-computed remainder r′ to be 0, we will start the second or more rounds until r′ becomes so.
3.2.2 Image Authentication Process
In this section we will authenticate protected images to see whether they are tampered with or not. We apply the same steps, from Step 1 to Step 3.4, in Algorithm 3.1. That is, we select randomly 18 pixel values according to Np from the corresponding 6×6 gray-level image and add them up; and in each block, we pick up the same divisor as we mentioned in the preceding discussion from the series Nd. Then we divide the sum by a divisor to get a remainder r. After these steps, we extract
the authentication signals to authenticate the image. If r is equal to 0, the corresponding block is decided to be correct, that is, not being tampered with. But if r is not equal to 0, we decide that the block might be modified, and mark it so in the image authentication report.
The detailed algorithm for image authentication is described in Algorithm 3.2 below.
Algorithm 3.2. Authentication of PNG images.
Input: a protected image Ip in PNG format, two secret keys p and d, and a random number generator f.
Output: An authentication report P for Ip. Steps.
1. Divide Ip into non-overlapping 3×3 blocks.
2. Use the two keys, g and h, as seeds for f to generate two series of distinct random numbers, Np and Nd, where the range of Np is limited to be between 0 and 35, and that of Nd is limited to be between 3 and 18.
3. For each 3×3 image block B, perform the following steps.
3.1. Compose a 6×6 gray-level image B′ with 36 pixels using the gray-level image planes of the three color channels and the alpha channel of B (as illustrated by Fig. 3.1).
3.2. Pick up in order 18 values from Np and regard them to represent the positions of 18 randomly selected pixels of B′.
3.3. Add up the gray values of the pixels of B′ located at the 18 positions to get a sum S.
3.4. Divide S by a divisor d selected in order from Nd to get a remainder r.
3.1 Consider the following cases to authenticate Ip.
a. When r = 0:
decide that image block B has been modified and mark it so in P.
b. When r ≠ 0:
decide that image block B has not been modified.
4. Take the final authentication report P as output.
3.3 Proposed Image Hiding Technique Based on Proposed Authentication Method
In this section, we will introduce a data hiding method which is based on the previously-mentioned authentication method. In Section 3.3.1, the secret data embedding process will be given. We will describe the data extraction process in Section 3.3.2.
As mentioned previously, we can apply the two methods to yield a combined image authentication method and data hiding method. The combination process will be described in Section 3.4.
3.3.1 Data Hiding Process
In this study, we propose a data hiding method which is based on the above-mentioned authentication method. And the detailed algorithm will be given.
Because this data hiding method is based the above-mentioned authentication method, the steps are almost the same as those of Algorithm 3.1. In this method, we use a key to generate randomly a series of distinct numbers, denoted as Np. The use of Np is the same as that in the proposed authentication method, representing the positions of a 6×6 gray-level image. We count the number of the odd gray values and that of even gray values located at the pixels at these selected positions in each block.
As to the secret data, we have to transfer every byte of them into binary. We hide secret data, each time by one bit, in each block by adjusting the numbers of odd gray values and even gray values, and then we can get a stego-image.
The detailed algorithm of secret data embedding is described in Algorithm 3.3 below.
Algorithm 3.3. Secret data embedding process for PNG images.
Input: a cover image C, a secret key g, a random number generator f, and a secret message D.
Output: a stego-image S.
Steps.
1. Divide C into non-overlapping 3×3 blocks.
2. Use the key g as a seed for f to generate a series of distinct random numbers, Np, where the range of Np is limited to be between 0 and 35.
3. Transform D into a binary string D′.
4. For each 3×3 image block B, perform the following steps.
4.1. Compose a 6×6 gray-level image B′ with 36 pixels using the gray-level image planes of the three color channels and the alpha channel of B (as illustrated in Fig. 3.1).
4.2. Pick up in order 18 values from Np and regard them to represent the positions of 18 randomly selected pixels of B′.
4.3. Count the number of odd gray values, O, and that of even gray values, E, of the pixels of B′ located at the 18 positions
4.4. Apply the following steps to hide D′, once a bit.
a. When O ≥ E:
i. when the next bit in D′ to be hidden is 0:
decrease the values of those selected pixels whose values are
To extract the secret data, we will do several steps as follows. Because we hide secret data in PNG images by a block-based method, we should also divide the image into blocks to extract the data. At first, we divide the protected image into non-overlapping 3×3 blocks. Then we use a user key to generate a series of random numbers, denoted as Np, which represents the positions of 18 selected pixel values in the block. We count the number of odd gray values O and that of even gray values E and compare them. If O > E, we decide that the hidden bit in this block is “1”. On the other hand, if O < E, we decide that the hidden bit in this block is “0.” After performing these steps, we can extract the secret data successfully.
The detailed algorithm of the proposed secret data extraction process is described in Algorithm 3.4 as follows.
Algorithm 3.4. Secret data extraction process for PNG images.
Input: a stego-image S., a secret key g, and a random number generator f.
Output: a secret message P.
Steps.
1. Divide C into non-overlapping 3×3 blocks.
2. Use the key g as seed for f to generate two series of distinct random numbers, Np, where the range of Np is limited to be between 0 and 35.
3. For each 3×3 image block B, perform the following steps.
3.1. Compose a 6×6 gray-level image B′ with 36 pixels using the gray-level image planes of the three color channels and the alpha channel of B (as shown in Fig. 3.1).
3.2. Pick up in order 18 values from Np and regard them to represent the positions of the 36 pixels of B′.
3.3. Count the number of odd gray values O and that of even gray values E of the pixels located at these 18 positions
3.4. Apply the following steps to extract data, once a bit:
a. when O ≥ E:
extract a bit of the secret data D to be 1;
b. when O < E:
extract a bit of the secret data D to be 1.
4. Combine the extracted bits of the secret data D together in order as D′.
5. Transform every 8 bits of D′ into a decimal number D′′ expressed as an ASCII code, and then transform D′′ into characters as the desired secret message P.
3.4 Combination of Proposed
Authentication Method and Data Hiding Method
As mentioned previously, we propose a method which combines the previously-proposed authentication method and data hiding method. The overall effect is a method for data hiding with the capability of authenticating the hidden data.
We call it a combined method for data hiding and authentication. In this combined method, we hide data first, and then adjust the selected pixel values to hide authentication signals. Different from the above-proposed simple authentication method, this combined algorithm adjusts the values in a different way. The detailed algorithm of the method is given below.
Algorithm 3.5. Combined method of data hiding and authentication for PNG images.
Input: an image C, two secret keys g and h, a secret message D, and a random number generator f.
Output: a stego-image S with authentication signals and secret data embedded.
Steps.
1. Divide C into non-overlapping 3×3 blocks.
2. Use the two keys, g and h, as seeds for f to generate two series of distinct random numbers, Np and Nd, where the range of Np is limited to be between 0 and 35, and that of Nd is limited to be between 3 and 18.
3. Transform D into a bit sequence D′.
4. For each 3×3 image block B, perform the following steps.
3.1. Compose a 6×6 gray-level image B′ with 36 pixels using the gray-level image planes of the three color channels and the alpha channel of B (as
shown in Fig. 3.1).
3.2. Pick up in order 18 values from Np and regard them to represent the positions of the 36 pixels of B′.
3.3. Count the number of odd gray values O and that of even gray values E of the pixels located at the 18 positions
3.4. (Data hiding) Apply Step 4.4 in Algorithm 3.3 to hide the data of D′, once a bit. values of the 18 selected pixels of B′.
a. If the hidden bit of D′ is “1,” that is, if O ≥ E:
I. when r ≥ d/2, d − r is odd, and the values of selected pixels are not all equal to 255:
i. pick up an even number, and increase it by one;
ii. increase the values of those selected pixels whose
ii. increase the values of those selected pixels whose