# Introduction he encoding process will be applied on 32-bit per pixel standards images (i.e. BMP, GIF, JPG and PNG).Pixels are encoded into four parts (RGBA) or (ARGB). ( A ) stands for Alpha, ( R ) for Red, ( G ) for Green and ( B ) for Blue. RGB was uniquely used as a base of pixels and to reproduce and present a broad array of colors while alpha has been added later to represent the transparency of the color [4]. Using RGB for encoding in this paper doesn't mean using old methods. RGB is still alive; it's the core of ARGB or even RGBAX. While alpha will be excluded from being processed in the first encoding method and will included later on. As mentioned, the structure of a pixel (let us refer to it as color) is a set of 32 bits; 32 bits = 4 bytes. 4 bytes/ 4 sets {A, R, G & B} = 1 bytes for each set. Therefore; Only 3 bytes will be modified when using the RGB encoding method while 4 bytes will be used in the ARGB encoding method. Hence, the described encoding method is light compared to those which use 256 or more [5,6]. Encoding and encryption are both routines performed on data; however the end results are quite different. In the case of encryption the purpose is to disguise the data such that it can't be read, except by the intended recipient. On the other hand, encoding is used merely to transform data into a more suitable format; it is the process of putting a sequence of objects (characters, letters, numbers, punctuation or any storage data type) into a specialized format for efficient transmission or storage. Consequently, encoding and encryption can be integrated to secure data, to prevent others from reaching it. Encryption is needed to prevent hackers, and encoding to communicate, transmit or exchange data [9]. The implementation is accomplished in three integrated phases to get the full vision. 1. Encryption (used to encrypt the keys of encoding and decoding) 2. Encoding/Decoding methods 3. Watermarking the image. # II. # Implementation We have two directions in term of implementing our image encoding/ decoding. The first demonstrates the encoding processes. And the other is for the decoding. The process is described in the following figure: a) Encoding Processes Fig. 2: Encoding process As shown in figure 2, the first step, we start encoding by loading the image we'd like to encode. In the second step, we generate encoding key as well as decoding keys. These keys are strongly recommended to be saved safely. They are basically the sole of encoding and decoding. Hence, we will encrypt them in such a way that we empower their safety. Then encrypt the keys and start encoding each pixel in the image. Finally, we display the new encoded image (or save it into a file). Generally, our methods of encoding images depend on a generated key of type integers. It contains 6 to 8 digits. And the same is for decryption. Thus makes it "unsafe". So we found that there is a need to encrypt them. There are two kinds of encryption ciphers that use keys. a. Single key encryption b. Two keys based encryption Two keys are used to strengthen the security; a public key which is used within the team to encrypt the data, and a private key which no data will be decrypted without it [2]. Fig. 4: Two Keys based Encryption Similar to encryption ciphers, in fact the encoding process; explained through this paper is a single key encoding and another key -decoding keyis generated based on the first one. As a result, the encoding method that we develop supports both the Single and the double key encoding. Practically, "Good encryption algorithms are hard to come by. They are exceptionally difficult to invent, and even when a new one is created, it is often quickly laden with patents and export restrictions, making it inconvenient or even impossible for others to reuse" [1]. Hence, we tried to use a very well-known encryption cipher called "RIJNDAEL Algorithm". RIJNDAEL is two ways encryption and used in keys decryption as well. It is one of the most powerful encryption solutions that serve the need in our research among several good encryption techniques of "System Security Cryptography" which is provided by .NET environment. Most variables needed for encryption using RIJNDAEL class could have static values like hash algorithm, Initial vector, salt and others. These variables can be managed dynamically to empower encryption/ decryption. More encryption power in is better encoding [10]. # d) Encoding / Decoding images As mentioned previously, we have used two methods for encoding/ decoding images based on pixels. i. RGB based encoding/decoding ii. ARGB based encoding/decoding Encoding using RGB and ARGB are almost the same in their structures. The only difference is that in the first one encodes the values of Red, Green and Blue whereas the second method encodes Alpha value -the transparency The main function is "Encode". It's of type color (pixel). It takes source color and the encoding key and returns a new color to be replaced at the same position. Simply, the idea of the encoding is to rearrange the color in hexadecimal format with the help of the generated encoding key. Then convert the new hexadecimal value to color data type to present a new Red, Green and Blue or new (Alpha, Red, Green and Blue in case of ARGB). Due to the fact that this kind of encoding is based on independent small blocks (pixels), it cannot be classified as strong encoding. However, our challenge was to develop a method based on recoloring the pixels. But is that all? off course not. What remains is watermarking the image. # e) Adding Watermark Adding watermark to an image is the process of embedding information (usually text or image) into an image in a way that it is difficult to remove [3]. Watermark is highly recommended for saving the copyrights especially in our case. Watermark is not a part of encoding, but we took the decision to integrate it with our encoding system to add the flavor of security and to save the copyright [7,8]. Programmatically, Adding watermark means merging two layers (or two images) one over the other and controlling the transparency of both based on the following formulas: Merging both images together is merging each pixel of them based on the formulas mentioned before; within this process the transparency of the signature is to be set to be half of the real value of it. ) 1 ( ) 1 ( a b a o a b b a a o C C C ? ? ? ? ? ? ? ? + = ? + = As a result of our work, the following screenshots show the images before and after the encoding. They show the original image, and how it has been encoded using both methods RGB and ARGB. Due to the fact that this encoding method is based on encoding each pixel in separate, we clearly notice that it is not powerful for encoding plain colors that have same hexadecimal values for all bytes of the pixel like white color (A=FF, R=FF, G=FF, B=FF) as seen in the backgrounds in figure 11 and 12. Other than that it will work fine. # III. # Conclusion We tried in this study to test image encoding/decoding by changing the sequence of hexadecimal values of RGB and ARGB. Each pixel is encoded to have the same structure and different values. We provided the encoding method by generating public and private keys. However, we used a function to generate a decoding key as a gate for decoding. Because we have two keys, we worked on a fast and powerful encryption cipher called "RIJNDAEL Cipher". Finally, to strengthen the encoding we watermarked the decoded images. 1![Fig. 1: The format of ARGB pixel](image-2.png "Fig. 1 :") 3![Fig. 3: Decoding process Referring to figure 3 we realize that the decoding process starts by loading the encoded image, then decrypting the keys and verify them in the following step. While in the third step the image to decoded. The process ends by watermarking the image. The three main important steps in both processes are: 1. Encryptions/Decryption the keys 2. Encoding/Decoding the image 3. Watermarking it. c) Encryption/ Decryption](image-3.png "Fig. 3 :") 5![Fig. 5: Flowchart of encoding image](image-4.png "Fig. 5 :") 8![Fig. 8: Pic. A over Pic. B Implementation of watermarks can be done in two steps. I. Preparing the stamp image (signature).](image-5.png "Fig. 8 :") 9![Fig. 9: Process line of preparing Signature imageIn the preparation step, the size of the signature image is checked and compared to the decoded image, to assure that it fits the decoded image or needs resizing.](image-6.png "Fig. 9 :") 10![Fig. 10: Process line of merging Signature and decoded image](image-7.png "Fig. 10 :") 11![Fig. 11: An image before and after RGB encoding](image-8.png "Fig. 11 :") 12![Fig. 12: An image before and after ARGB encoding](image-9.png "Fig. 12 :") * RichardHeathfield LawrenceKirby EtAl 2002 C Unleashed * Cryptography Engineering: Design Principles and Practical Applications NielsFerguson BruceSchneier TadayoshiKohno 2010 Wiley * CRafael RichardEGonzalez StevenLWoods Eddins Digital Image Processing Using MATLAB Gatesmark Publishing 2009 2nd edition * CRafael RichardEGonzalez Woods Digital Image Processing Prentice Hall 2007 3rd edition * Alvy RaySmith Image Compositing Fundamentals. Microsoft Tech Memo 4 1995 * Alpha and the History of Digital Compositing Alvy RaySmith Microsoft Tech Memo 7 1995 * Watermarking Algorithm Research and Implementation Based on DCT Block GengmingZhu NongSang World Academy of Science, Engineering and Technology 45 2008 * Digital Watermarking. A paper submitted in fulfillment of the requirements for DISS 780 MChaelynne Wolak 2000 Nova Southeastern University * Cryptography for Developers TomSt Denis 2007 Syngress * The Design of Rijndael: AES -The Advanced Encryption Standard JoanDaemen VincentRijmen 2002 Springer