A
Report On
“Image Steganography”
Under the subject
‘Mobile Application Development [22617]’
P
AP
Submitted by
n
tio
Sr. No Enrollment No Name of the student
1 1700100271 Miss. Shinde Mohini Anandrao
lu
2 1700100276 Miss. Jagtap Sakshi Krushna
So
TE
SB
Under the guidance of
M
Mrs. Gaikwad K. K
Department of Computer Engineering
Government Polytechnic, Karad
1.0 Rationale
Steganography is the process of hiding a secret message within a larger one in
such a way that someone cannot know the presence or contents of the hidden message.
Although related, Steganography is not to be confused with Encryption, which is the
process of making a message unintelligible—Steganography attempts to hide the
existence of communication. The main advantage of steganography algorithm is because
of its simple security mechanism. Because the steganographic message is integrated
invisibly and covered inside other harmless sources, it is very difficult to detect the
message without knowing the existence and the appropriate encoding scheme.
The objective of this project is to develop an Android Application that hide an
secret message behind the image (Steganography).
P
2.0 Aim of the project
AP
1. To analyze principle of Image Steganography.
2. To address importance of Android Language.
n
3. To study Android Language. tio
4. To implement App for Image Steganography.
3.0 Course Outcomes Achieved
lu
So
1. Interpret features of Android Operating System.
2. Develop rich user Interfaces by using layouts and controls.
3. Use User Interface components for android application development.
TE
4. Publish Android Applications.
4.0 Literature Review
SB
Author (Publication) Abstract Conclusion
M
Prasenjit Kar, Rajiv Kumar This paper consisted special We used this paper to learn the
(Research Gate) Steganography approach Steganography and its
carried at android platform approaches at android
platform.
Azmat Ullah, Mohsin Ijaz This paper includes the We used this paper to
(IRJET) implementation of LSB understand the concept of
algorithm. This application image Steganography and its
allow user to set password on implementation using LSB
stego image algorithm.
Lizeth Chandi, Catarina Silva This paper gives We used this paper to learn the
(Research Gate) characterization of current current development process
mobile application of android applications.
development processes based
on a practical experience.
Kishore Baktha This research paper includes We used this paper to
(IJCSMC) all the steps and guidelines for understand all the guidelines
successful creation of Mobile for successful creation of
app. Mobile app.
Table 1- Literature Review
P
AP
5.0 Actual procedure followed
n
Actual procedure followed during the project is mentioned in the table below with
tio
the planned start date and completed finish date.
Sr.no Details of activity Planned Planned Name of
lu
Start date Finish date responsible Team
So
members
1. Decide project topic 18/12/2019 25/12/2019 1. Shinde Mohini
2. Jagtap Sakshi
TE
2. Collecting information about 25/12/2019 01/01/2020 1. Shinde Mohini
Image Steganography 2. Jagtap Sakshi
SB
3. Prepare project proposal 01/01/2020 08/01/2020 1. Shinde Mohini
2. Jagtap Sakshi
4. Understanding concepts of 08/02/2020 22/01/2020 1. Shinde Mohini
M
Android Language 2. Jagtap Sakshi
5. Designing the Image 22/01/2020 12/02/2020 1. Shinde Mohini
Steganography 2. Jagtap Sakshi
6. Implementing functionality 12/02/2020 22/02/2020 1. Shinde Mohini
of android applications 2. Jagtap Sakshi
7. Debug the program code 26/02/2020 04/03/2020 1. Shinde Mohini
2. Jagtap Sakshi
8. Observing Output 04/03/2020 11/03/2020 1. Shinde Mohini
2. Jagtap Sakshi
9. Preparing final project 11/03/2020 18/03/2020 1. Shinde Mohini
report 2. Jagtap Sakshi
Table 2- Actual procedure followed
Program code
activity_main.xml
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_margin="16dp" android:layout_width="match_parent"
android:layout_height="match_parent"><Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Encode"
android:layout_marginTop="125dp" android:layout_centerHorizontal="true"
android:layout_alignParentTop="true" android:id="@+id/encode_button"/><Button
P
android:layout_width="wrap_content" android:layout_height="wrap_content"
AP
android:text="Decode" android:layout_marginTop="65dp" android:id="@+id/decode_button"
android:layout_below="@+id/encode_button"
android:layout_alignEnd="@+id/encode_button"/></RelativeLayout>
n
tio
activity_encode.xml
lu
<?xml version="1.0" encoding="utf-8"?>
So
<RelativeLayout android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_margin="16dp"
xmlns:android="http://schemas.android.com/apk/res/android" >
TE
<ImageView
SB
android:id="@+id/imageview"
android:layout_width="200dp"
android:layout_height="200dp"
M
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<Button
android:id="@+id/choose_image_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Choose Image" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/choose_image_button"
android:layout_marginTop="45dp"
android:layout_toStartOf="@+id/choose_image_button"
android:text="Message - "
android:textAlignment="center"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/textView"
android:layout_below="@+id/message"
P
android:layout_marginTop="35dp"
android:text="Secret Key - "
AP
android:textAlignment="center"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
n
android:textSize="16sp"
tio
android:textStyle="bold" />
lu
<EditText
android:id="@+id/secret_key"
So
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView2"
TE
android:layout_alignBottom="@+id/textView2"
android:layout_alignParentEnd="true"
android:layout_marginEnd="19dp"
SB
android:ems="10"
android:hint="Enter secret key"
android:inputType="textPassword"
M
android:textSize="14sp" />
<EditText
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/secret_key"
android:layout_alignTop="@+id/textView"
android:ems="10"
android:hint="Enter message"
android:inputType="textPersonName"
android:textSize="14sp" />
<Button
android:id="@+id/encode_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginEnd="17dp"
android:layout_toStartOf="@+id/secret_key"
android:text="Encode"
android:textAlignment="center"
android:textSize="14dp" />
<Button
android:id="@+id/save_image_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/secret_key"
android:layout_alignTop="@+id/encode_button"
P
android:layout_marginEnd="36dp"
android:text="Save Image" />
AP
<TextView
android:id="@+id/whether_encoded"
n
android:layout_width="70dp"
tio
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
lu
android:layout_alignParentTop="true"
android:textStyle="bold" />
So
</RelativeLayout>
TE
activity_decode.xml
<?xml version="1.0" encoding="utf-8"?>
SB
<RelativeLayout android:layout_height="match_parent"
android:layout_width="match_parent"
M
android:layout_margin="16dp"
xmlns:android="http://schemas.android.com/apk/res/android" >
<ImageView
android:id="@+id/imageview"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<Button
android:id="@+id/choose_image_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Choose Image" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/choose_image_button"
android:layout_marginTop="45dp"
android:layout_toStartOf="@+id/choose_image_button"
android:text="Secret Key -"
android:textAlignment="center"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="16sp"
android:textStyle="bold" />
P
<TextView
AP
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
n
android:layout_alignBaseline="@+id/message"
tio
android:layout_alignBottom="@+id/message"
android:layout_alignStart="@+id/textView"
lu
android:text="Message"
android:textAlignment="center"
So
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="16sp"
TE
android:textStyle="bold" />
<EditText
SB
android:id="@+id/secret_key"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
M
android:layout_alignBaseline="@+id/textView"
android:layout_alignBottom="@+id/textView"
android:layout_alignParentEnd="true"
android:layout_marginEnd="18dp"
android:ems="10"
android:hint="Enter secret key"
android:inputType="textPassword"
android:textSize="14sp" />
<EditText
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/decode_button"
android:layout_alignStart="@+id/secret_key"
android:layout_marginBottom="20dp"
android:ems="10"
android:hint="Your message"
android:inputType="textPersonName"
android:textSize="14sp" />
<Button
android:id="@+id/decode_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Decode"
android:textAlignment="center"
android:textSize="14dp" />
P
<TextView
AP
android:id="@+id/whether_decoded"
android:layout_width="70dp"
android:layout_height="wrap_content"
n
android:layout_alignParentStart="true"
tio
android:layout_alignParentTop="true"
android:textStyle="bold" />
lu
</RelativeLayout>
So
MainActivity.java
TE
package com.ayush.steganography;
SB
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
M
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button encode = findViewById(R.id.encode_button);
Button decode = findViewById(R.id.decode_button);
encode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getApplicationContext(), Encode.class));
}
});
decode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getApplicationContext(), Decode.class));
}
});
P
Encode.java
AP
package com.ayush.steganography;
import android.Manifest;
n
import android.app.ProgressDialog;
tio
import android.content.Intent;
import android.content.pm.PackageManager;
lu
import android.graphics.Bitmap;
import android.net.Uri;
So
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
TE
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
SB
import android.util.Log;
import android.view.View;
import android.widget.Button;
M
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.ayush.imagesteganographylibrary.Text.AsyncTaskCallback.TextEncodingCallback;
import com.ayush.imagesteganographylibrary.Text.ImageSteganography;
import com.ayush.imagesteganographylibrary.Text.TextEncoding;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
public class Encode extends AppCompatActivity implements TextEncodingCallback {
private static final int SELECT_PICTURE = 100;
private static final String TAG = "Encode Class";
//Created variables for UI
private TextView whether_encoded;
private ImageView imageView;
private EditText message;
private EditText secret_key;
//Objects needed for encoding
private TextEncoding textEncoding;
private ImageSteganography imageSteganography;
private ProgressDialog save;
private Uri filepath;
//Bitmaps
private Bitmap original_image;
P
private Bitmap encoded_image;
AP
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
n
setContentView(R.layout.activity_encode);
tio
//initialized the UI components
lu
whether_encoded = findViewById(R.id.whether_encoded);
So
imageView = findViewById(R.id.imageview);
TE
message = findViewById(R.id.message);
secret_key = findViewById(R.id.secret_key);
SB
Button choose_image_button = findViewById(R.id.choose_image_button);
Button encode_button = findViewById(R.id.encode_button);
Button save_image_button = findViewById(R.id.save_image_button);
M
checkAndRequestPermissions();
//Choose image button
choose_image_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ImageChooser();
}
});
//Encode Button
encode_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
whether_encoded.setText("");
if (filepath != null) {
if (message.getText() != null) {
//ImageSteganography Object instantiation
imageSteganography = new ImageSteganography(message.getText().toString(),
secret_key.getText().toString(),
original_image);
//TextEncoding object Instantiation
textEncoding = new TextEncoding(Encode.this, Encode.this);
//Executing the encoding
textEncoding.execute(imageSteganography);
}
}
}
});
P
//Save image button
AP
save_image_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
n
final Bitmap imgToSave = encoded_image;
tio
Thread PerformEncoding = new Thread(new Runnable() {
@Override
lu
public void run() {
saveToInternalStorage(imgToSave);
So
}
});
save = new ProgressDialog(Encode.this);
TE
save.setMessage("Saving, Please Wait...");
save.setTitle("Saving Image");
save.setIndeterminate(false);
SB
save.setCancelable(false);
save.show();
PerformEncoding.start();
M
}
});
}
private void ImageChooser() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//Image set to imageView
if (requestCode == SELECT_PICTURE && resultCode == RESULT_OK && data != null
&& data.getData() != null) {
filepath = data.getData();
try {
original_image = MediaStore.Images.Media.getBitmap(getContentResolver(),
filepath);
imageView.setImageBitmap(original_image);
} catch (IOException e) {
Log.d(TAG, "Error : " + e);
}
}
P
}
AP
// Override method of TextEncodingCallback
@Override
n
public void onStartTextEncoding() {
tio
//Whatever you want to do at the start of text encoding
}
lu
@Override
So
public void onCompleteTextEncoding(ImageSteganography result) {
//By the end of textEncoding
TE
if (result != null && result.isEncoded()) {
encoded_image = result.getEncoded_image();
SB
whether_encoded.setText("Encoded");
imageView.setImageBitmap(encoded_image);
}
M
private void saveToInternalStorage(Bitmap bitmapImage) {
OutputStream fOut;
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOWNLOADS), "Encoded" + ".PNG"); // the File to
save ,
try {
fOut = new FileOutputStream(file);
bitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fOut); // saving the Bitmap
to a file
fOut.flush(); // Not really required
fOut.close(); // do not forget to close the stream
whether_encoded.post(new Runnable() {
@Override
public void run() {
save.dismiss();
}
});
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private void checkAndRequestPermissions() {
int permissionWriteStorage = ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE);
int ReadPermission = ContextCompat.checkSelfPermission(this,
Manifest.permission.READ_EXTERNAL_STORAGE);
P
List<String> listPermissionsNeeded = new ArrayList<>();
if (ReadPermission != PackageManager.PERMISSION_GRANTED) {
AP
listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);
}
if (permissionWriteStorage != PackageManager.PERMISSION_GRANTED) {
n
listPermissionsNeeded.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
tio
}
if (!listPermissionsNeeded.isEmpty()) {
lu
ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[0]),
1);
So
}
}
TE
}
SB
Decode.java
package com.ayush.steganography;
M
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.ayush.imagesteganographylibrary.Text.AsyncTaskCallback.TextDecodingCallback;
import com.ayush.imagesteganographylibrary.Text.ImageSteganography;
import com.ayush.imagesteganographylibrary.Text.TextDecoding;
import java.io.IOException;
public class Decode extends AppCompatActivity implements TextDecodingCallback {
private static final int SELECT_PICTURE = 100;
private static final String TAG = "Decode Class";
//Initializing the UI components
private TextView textView;
private ImageView imageView;
private EditText message;
private EditText secret_key;
private Uri filepath;
P
//Bitmap
private Bitmap original_image;
AP
@Override
protected void onCreate(Bundle savedInstanceState) {
n
super.onCreate(savedInstanceState);
tio
setContentView(R.layout.activity_decode);
lu
//Instantiation of UI components
textView = findViewById(R.id.whether_decoded);
So
imageView = findViewById(R.id.imageview);
TE
message = findViewById(R.id.message);
secret_key = findViewById(R.id.secret_key);
SB
Button choose_image_button = findViewById(R.id.choose_image_button);
Button decode_button = findViewById(R.id.decode_button);
M
//Choose Image Button
choose_image_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ImageChooser();
}
});
//Decode Button
decode_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (filepath != null) {
//Making the ImageSteganography object
ImageSteganography imageSteganography = new
ImageSteganography(secret_key.getText().toString(),
original_image);
//Making the TextDecoding object
TextDecoding textDecoding = new TextDecoding(Decode.this, Decode.this);
//Execute Task
textDecoding.execute(imageSteganography);
}
}
});
P
private void ImageChooser() {
AP
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
n
startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
tio
}
lu
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
So
super.onActivityResult(requestCode, resultCode, data);
//Image set to imageView
TE
if (requestCode == SELECT_PICTURE && resultCode == RESULT_OK && data != null
&& data.getData() != null) {
SB
filepath = data.getData();
try {
original_image = MediaStore.Images.Media.getBitmap(getContentResolver(),
M
filepath);
imageView.setImageBitmap(original_image);
} catch (IOException e) {
Log.d(TAG, "Error : " + e);
}
}
@Override
public void onStartTextEncoding() {
//Whatever you want to do by the start of textDecoding
}
@Override
public void onCompleteTextEncoding(ImageSteganography result) {
//By the end of textDecoding
if (result != null) {
if (!result.isDecoded())
textView.setText("No message found");
else {
if (!result.isSecretKeyWrong()) {
textView.setText("Decoded");
message.setText("" + result.getMessage());
} else {
textView.setText("Wrong secret key");
}
P
}
} else {
AP
textView.setText("Select Image First");
}
n
}
tio
}
lu
Outputs:
So
TE
SB
M
Fig1. App with its icon Fig2. Main Activity with two options
P
AP
n
tio
Fig3. An activity to encode the message Fig4. An activity showing Encoded message
lu
So
TE
SB
M
Fig5. An activity to decode message Fig6. An activity showing Decoded message
6.0 Actual Resources Required
The resources used during the completion of project are mentioned in the below
Sr. Name of resources Specifications Quantity Remarks
No material
1. YouTube MP4-file format, 640 x 1
360 pixels
2. Microsoft Word 2010 version 1
3. Laptop Dell, RAM 8 GB, 1
Harddisk 1 TB, i3
processor
4. Android Studio android-studio-ide- 1
191.6010548-windows
P
5. SQLite SQLite Software 1
AP
n
8.0 Skill Developed/ learning out of this Micro-Project
tio
We learnt,
lu
1. The Android Programming.
2. The concept of Image Steganography.
So
3. To develop an Android Applications.
4. Efficient communication skills.
TE
5. Working as a team member for developing c program.
6. Developing leadership qualities.
SB
9.0 Applications of the Project
1. This project can be used in the implementation of User Interface components for android
M
application development.
2. The project can be also used to understand the concept of features of Android Operating
System.
3. The project can be used in learning and developing Android Applications.
Subject Teacher
Mrs. Gaikwad K. K