Online Art Gallery: Krishnasamy College of Engineering & Technology

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 50

ONLINE ART GALLERY

By

Reg No.: 421317621365 S. PRIYANGA


Reg No.: 421317621341 K. SOWMIYA

of

KRISHNASAMY
COLLEGE OF ENGINEERING & TECHNOLOGY
Cuddalore - 607 109.

A PROJECT REPORT
Submitted to the

FACULTY OF INFORMATION AND COMMUNICATION


ENGINEERING
In partial fulfillment of the requirements
for the award of the degree

of

MASTER OF COMPUTER APPLICATIONS

ANNA UNIVERSITY
CHENNAI - 600 025.

September 2019
ii

KRISHNASAMY
COLLEGE OF ENGINEERING & TECHNOLOGY
Anand Nagar, Nellikuppam Main Road, S.Kumarapuram,
Cuddalore- 607 109.

Department of Computer Applications (MCA)

BONAFIDE CERTIFICATE

Certified that this project report titled “ONLINE ART GALLERY” is


the bonafide work of Miss. PRIYANGA S (Reg. No. : 421317621365), Miss.
SOWMIYA K (Reg. No. : 4213176341) who carried out the research under
my supervision. Certified further, that to the best of my knowledge the work
reported herein does not form part of any other project report or dissertation on
the basis of which a degree or award was conferred on an earlier occasion on
this or any other candidate.

PROJECT GUIDE HEAD OF THE DEPARTMENT


Mr. J.JAYAPANDIAN, M.C.A, M.Phil., Mrs. R. Vijayalakshmi, M.C.A, M.Phil.,
(Ph.D.),
Assistant Professor, Associate Professor,
Department of Computer Applications. Department of Computer Applications.

Date of project & viva-voce:

INTERNAL EXAMINER EXTERNAL EXAMINER


iii

ABSTRACT

An art gallery exhibits the works of many artists. Each artist is given a
specified space on the online webpage. The artists are charged for the space allotted to
them on daily basis. The charges vary in different months. Jan to April and August to
December the charges are Rs 200 per day per exhibit, from May to July charges are
Rs 300 per day per exhibit. Each exhibit has a name and style of painting. The
exhibits can be bought by the online customers who need to register with the art
gallery.
On receiving the full payment, the painting is sent to the customer. The system
keeps track of the status of delivery of the painting to the customer. This status can
also be seen by the customer. The gallery also stores the information about the visitors
of the gallery who need not register with the art gallery website. For visitors only
email id of the visitor is asked. Every month a complete information of business
through online site is created for the artists as well as for the site promoters.
iv

ACKNOWLEDGEMENT

I (VIJAYASRI A) would like to extend my heartfelt thanks to Our Chairman Dr.


K. RAJENDRAN, M.S., FICS., FAIS., who has given us an excellent opportunity to exhibit
the mode of creativity by this project.

I wish to express my gratitude and deepest thanks to our dynamic and beloved
Principal Dr. G. ELANGO, M.E., Ph.D., who has provided all the help needed in
executing the project successfully in our college.

I convey my genuine thanks to our Vice-Principal Dr. K. RAGHU, M.Sc., M.Phil.,

Ph.D., who has supported in completing the project successfully.

I convey my grateful thanks to Mrs. R. VIJAYALAKSHMI, M.C.A., M. Phil., (Ph.D.),

Associate Professor & Head of MCA department, for the valuable suggestion and
comments that she provided apart from sharing project expertise when it was needed
from the beginning.

I convey my sincere thanks to my Project Advisor Mr. S. Barath, M.C.A., M. Phil.,

and Project Guide Mr. R. Ambikapathy, M.C.A., M. Phil., Assistant Professors of MCA
department, for the great guidance and training given during the project period in
completing the project.

Finally, I would like to use this opportunity to impart my sincere thanks to all the
Teaching and non-teaching staff members of MCA department and my friends for all
the help provided by them, for the successful completion of this project.
VIJAYASRI A

TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE NO.


ABSTRACT iii

1 INTRODUCTION
1.1 Project Description 1
1.2 Scope of the project 1

2 SYSTEM ANALYSIS
2.1 Existing System 2
2.2 Feasibility Study 2
2.3 Proposed System 3
2.4 Featurs of proposed system 3

3 SYSTEM IMPLEMENTATION
3.1 Hardware Requirement 4
3.2 Software Requirement 4
3.3 Software Description 5
3.3.1 Java Overview 5
3.3.2 Swing Overview 8

4 SYSTEM DESIGN
4.1 Architecture System 10

4.2 Module Description 11


4.3 Detailed Design 13
4.4 Software Modeling 14
4.4.1 Sequence Diagram 14
4.4.2 Usecase Diagram 16
4.4.3 Class Diagram 18
4.4.4 Activity Diagram 19
5 SYSTEM TESTING
5.1 Introduction 20
5.2 Types of Testing 21
6 RESULT
Appendix 1 – Screen Shots 22
Appendix 2 – Sample Coding 25
7 CONCLUSION 44
8 FUTURE ENHANCEMENT 45
REFERENCES 46

Chapter 1

1. INTRODUCTION
Our project, DIGITAL STEGANOGRAPHY overcomes this factor and it
gives a solution for transmitting secret formation with out affecting unintended users.
Stegano graphy uses multimedia data as a covering medium (Covering secret
information). By using steganography data (secret information) can hided with in data
(multimedia data, here multimedia data is an image) and it can be sent anywhere to
transfer the message easily without giving any suspicion to others.

Steganography is the art of hiding the fact that communication is taking place,
by hiding information in other information. This project is developed for hiding
information in any image file. The scope of the project is implementation of
steganography tools for hiding information includes any type of information file and
image files and the path where the user wants to save Image and extruded file. .

Chapter 2

2. SYSTEM ANALYSIS
2.1 EXISTING SYSTEM
In the existing system, secret messages can be transferred but it gives irritation
to the unintended people. And also maintaining secrecy is very tough because of the
intelligent of the hackers. Already we have cryptography for transmitting secret
information. Even though cryptography successfully transmitting secret information,
it will give a suspicion to the hackers and it affects unintended users.

Steganography is the practice of hiding private or sensitive information within


something that appears to be nothing out to the usual. Steganography is often
confused with cryptology because the two are similar in the way that they both are
used to protect important information. The difference between two is that
steganography involves hiding information so it appears that no information is hidden
at all.

Many different carrier file formats can be used, but digital images are the most
popular because of their frequency on the internet. For hiding secret information in
images, there exists a large variety of steganography techniques some are more
complex than others and all of them have respective strong and weak points

2.3 PROPOSED SYSTEM


Our project, DIGITAL STEGANO GRAPHY overcomes this factor and it
gives a solution for transmitting secret formation with out affecting unintended users.
Stegano graphy uses multimedia data as a covering medium (Covering secret
information). By using stegano graphy data (secret information) can hided with in
data (multimedia data, here multimedia data is an image) and it can be sent anywhere
to transfer the message easily without giving any suspicion to others.
.
Different applications may require absolute invisibility of the secret
information, while others require a large secret message to be hidden. This project
report intends to give an overview of image steganography, its uses and techniques. It
also attempts to identify the requirements of a good steganography algorithm and
briefly reflects on which steganographic techniques are more suitable for which
applications.

2.4 Features of proposed system:


1 Provides a user friendlier interface.
2 Developed in java. So platform independent.
3 Highly flexible.

Chapter 3
SYSTEM IMPLEMENTATION

3.1 HARDWARE REQUIREMENT

 Processor: Pentium IV
 40 GB hard disk space.
 256 MB RAM or more.
 1.44 Floppy Disk Drive.
 104 keys keyboard.
 Display capable of showing 65,000 colors or more.
 CD-ROM Drive for installing the package.
 Mouse with minimum two buttons.

3.2 SOFTWARE REQUIREMENT

 Front End: Java (jdk1.4.1 and above)


 OS : Windows / Linux / Solaris

3.3 SOFTWARE DESCRIPTION

3.3.1 JAVA

Java Features Of Java

The inventors of Java wanted to design a language which could offer


solutions to some of the problems encountered in modern programming. They
wanted the language to be not only reliable, portable and distributed but also simple,
compact and interactive. Sun Microsystems officially describes java with the
following attributes.

Compiled and Interpreted


Usually a computer language is either compiled or interpreted. Java combines
both these approaches thus making java a two-stage system. First, java compiler
translates source code into what is known as byte code instructions. Byte codes are
not machine instructions and therefore, in the second stage, java interpreter generates
machine code that can be directly executed by the machine that is running the java
program. We can thus say that java is both a compiled and interpreted languages.
Platform-Independent and Portable
The most significant contribution of java over other languages is its
portability. Java programs can be easily moved from one computer system to another,
anywhere and anytime. Changes and upgrades in operating systems, processors and
system resources will not force any changes in Java programs. This is the reason why
Java has become a popular language for programming on Internet which interconnects
different kinds of systems worldwide. We can download a Java applet from a remote
computer onto out local system via Internet and execute it locally. This makes the
Internet an extension of the user’s basic system providing practically unlimited
number of accessible applets and applications.

Java ensures portability in two ways. First, Java compiler generates byte code
instructions that can be implemented on any machine. Secondly, the sizes of the
primitive’s data types are machine-independent.

Object-Oriented
Java is a true object-oriented language. Almost everything in Java is an
object. All program code and data reside within objects and classes. Java comes with
an extensive set of classes, arranged in packages that we can use in our programs by
inheritance. The object model in Java is simple and easy to extend.

Robust and Secure


Java is a robust language. It provides many safeguards to ensure reliable code.
It has strict compile time and run time checking for data types. It is designed as a
garbage-collected language relieving the programmers virtually all memory
management problems. Java also incorporates the concept of exception handling
which captures series errors and eliminates any risk of crashing the system.

Security becomes an important issue for a language that is used for


programming on Internet. Threat of viruses and abuse of resources is everywhere.
Java systems not only verify all memory access but also ensure that no viruses are
communicated with an applet. The absence of pointer in Java ensures that programs
cannot gain access to memory locations without proper authorization.

Distributed
Java is designed as a distributed language for creating applications on
networks. It has the ability to share both data and programs. Java applications can
open and access remote objects on Internet as easily as they can do in a local system.
This enables multiple programmers at multiple remote locations to collaborate and
work together on a single project.

Simple, Small and Familiar


Java is a small and simple language. Many features of C and C++ that are
either redundant or sources of unreliable code are not part of Java. For example, java
does not use pointers, preprocessor header files, go to statement and many others. It
also eliminates operators overloading and multiple inheritance.

Familiarity is another striking feature of Java. To make the language look


familiar to the existing programmers, it was modeled on C and C++ languages. Java
uses many constructs of C and C++ and therefore, Java code “looks like a C++” code.

Multithreaded and Interactive


Multithreaded means handling multiple tasks simultaneously. Java supports
multithreaded programs. This means that we need not wait for the application to
finish one task before beginning another. For example, we can listen to an audio clip
while scrolling a page and at the same time download an applet from a distant
computer. This feature greatly improves the interactive performance of graphical
applications.

The Java runtimes comes with tools that support multiprocess synchronization
and construct smoothly running interactive systems.

High Performance
Java performance is impressive for an interpreted language, mainly due to the
use of intermediate byte code. According to Sun, Java speed is comparable to the
native C/C++. Java architecture is also designed to reduce overheads during runtime.
Further, the incorporation of multithreading enhances the overall execution speed of
java programs.

Dynamic and Extensible


Java is a dynamic language. Java is capable of dynamically linking in new
class libraries, methods and objects. Java can also determine the type of class through
a query, making it possible to either dynamically link or abort the program, depending
on the response.

Java programs support functions written in other languages such as C and C+


+. These functions are known as native methods. This facility enables the
programmers to use the efficient functions available in these languages. Native
methods are linked dynamically at runtime.

3.3.2 SWING - OVERVIEW


The original GUI components from the Abstract Windowing Toolkit package
Java.awt (also called the AWT) are tied directly to the local platform’s graphical
user interface capabilities. So, a java program executing on different platforms
has a different appearance and sometimes even different user interacts with the
program are known as that program’s look and feel. The Swing components allow
the programmer to specify a different look and feel across all platforms, or even to
change the look-and-feel while the program is running.

Swing components are often referred to as lightweight components they are


written completely in java so they are not “weighed down” by the complex GUI
capabilities of the platform on which they are used. AWT

Components (many of which parallel the Swing components) that are tied to
the local platform are correspondingly called heavyweight components they are
rely on the local platform’s windowing system to determine their functionality and
their look feel. Each heavyweight component has a peer (from package
java.awt.peer) that is responsible for the interactions between the component and
the local platform to display and manipulate the component.

FEATURES OF SWING OVER AWT:


Even the simplest Swing components have capabilities far beyond what the AWT
components offer.

1 Swing buttons and labels can display images instead of , or in addition to, text
2 You can easily add or change the borders drawn around most Swing
components. For example, it’s easy to put a box around the outside of a
container or label.
3 You can easily change the behavior or appearance of a Swing component by
either invoking methods on it or creating a subclass of it.
4 Swing components don’t have to be rectangular. Buttons, for example, can be
round.
5 Assistive technologies such as screen readers can easily get information from
Swing components. For example, a tool can easily get the text that’s displayed
on a button or label.
Swing lets you specify which look and feel your program’s GUI uses. By
contrast, AWT components always have the look and feel of the native
platform.

Chapter 4
SYSTEM DESIGN

4.1 ARCHITECTURE OF THE SYSTEM

Architecture of the system

Receiver (Extracting
Sender (Hiding Secret Information)
Data)

Secret Code
(Secret code + Secret
Information +
Multimedia data) Stegano Medium

Stegano Medium
Stegano Medium Secret Information

4.2 MODULE DESCRIPTION


In this project there are two modules, namely

1. “Making stegano Medium”


2. “Getting secret information from stegano medium”

Each of the modules is described in detail as follows.


In making stegano Medium side, the secret information is hided with in
an image file. Before hiding, for security, user has to enter a user code and
secret information. A secret code will be generated using user code + secret
information and this secret code will be used by the receiver to extract the
secret information. After generating secret code stegano medium will be
generated. This stegano medium is the final output and expected output from
the sender side.

Steganography is the art of hiding the fact that communication is


taking place, by hiding information in other information. This project is
developed for hiding information in any image file. The scope of the project is
implementation of steganography tools for hiding information includes any
type of information file and image files and the path where the user wants to
save Image and extruded file. .

4.3 DETAILED DESIGN


Algorithm:

Making Stegano Medium:

Step 1: Start the process


Step 2: Enter the Secret Information
Step 3: Enter the User Code
Step 4: Load a multimedia data, here it is an Image
Step 5: Creation of Secret Code by using user code + secret information
Step 6: Hiding secret information with its security into the multimedia data
Step 7: A message box showing the secret key will appear
Step 8: Stop the process

Extracting secret information from Steganography medium:

Step 1: Start the process


Step 2: Enter the Secret Code
Step 3: Enter the Stegano Medium
Step 4: Extract secret information from stegano medium by using secret code.
Step 5: Stop the Process

4.4 SOFTWARE MODELING


4.4.1 Sequence Diagram:

Sender Hide

1: Load

Picture

2: User

Code

3: Secret

Information

4. Stegano

Medium

5: Secret

Code
Receiver Break

1: Stegano

Medium

2: Secret

Code

5: Secret

Information
4.4.2 Use Case Diagram:

Sender:

Loading Picture

Entering User Code

Sender
Entering Secret Information

Generating Secret Code

Creating Stegano Medium


Receiver:

Loading Stegano
Medium

Entering Secret Code

Receiver
Getting Secret Information
4.4.3 Class Diagram:

Client:

Hide()
Break()

Hide
Break
User Code
Secret Information Secret Code
Picture Setagano Medium
Setagano Medium Secret Information
Secret Code
Break()

Hide()
4.4.4 Activity Diagram:

Start

Start Stegano
Application

Select Operation

Hide Break

Load Image Load Image

Enter User Code Enter Secret Code

Generate Secret Code Extract Secret Information

Generate Stegano Medium End

End
Chapter 5

SYSTEM TESTING

5.1 INTRODUCTION

System Testing is the testing of a complete and fully integrated software


product. Usually, software is only one element of a larger computer-based system.
Ultimately, software is interfaced with other software/hardware systems. System
Testing is actually a series of different tests whose sole purpose is to exercise the full
computer-based system.

System testing is testing conducted on a complete integrated system to


evaluate the system's compliance with its specified requirements. System testing
takes, as its input, all of the integrated components that have passed integration
testing.
5.2 TYPES OF TESTING
The testing of a conventional software system involves some of the following phases.
They are
 Unit Testing
 Integrated Testing
 System Testing

Unit Testing:
A software module can be created by building up of many small parts
into a single module. This small part is called as a unit. A unit is a piece of code
that will perform a specific task. At the end of this testing all units will be tested
so that we can get the correct result. By using unit testing we can easily identify
the errors.

Integration Testing:

Combining all programs into a single application and testing its correct
is called as Integration testing. Even all programs work correctly they may give a
false result when they work together. Integration is very important to get the
completed result.

System Testing:

System testing means testing the whole system at once. By giving


different inputs to the system we can check its correctness. For all inputs the
system should produce correct result.
Chapter 6

RESULTS

Appendix 1-Screen Shots

HomeScreen:

ComposePage:
Key Generation:

Load Multimedia Image:


BreakPage:

Secret Information:
Appendix 2-Sample Coding

Home.java

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Home extends JFrame implements ActionListener
{ private JButton compose,breakmsg;
private JLabel title,image;

Home()
{
super("Steganography");
Container con=getContentPane();
con.setLayout(null);
title=new JLabel("Digital Steganography");
title.setBounds(390,200,450,20);
image=new JLabel(new ImageIcon("D:/Home1/Sunset.jpg"));
image.setVisible(true);
con.setLayout(new FlowLayout());
image.setSize(450,80);
add(image);
this.setSize(450,80);
this.show();
this.setDefaultCloseOperation(EXIT_ON_CLOSE);

title.setFont(new Font("TimesNewRoman", Font.BOLD, 18));


compose=new JButton("Sender");
compose.addActionListener(this);
compose.setBounds(300,350,150,50);

breakmsg=new JButton("Receiver");
breakmsg.addActionListener(this);
breakmsg.setBounds(550,350,150,50);
con.add(title);
con.add(compose);
con.add(breakmsg);
con.add(image);
}

public void actionPerformed(ActionEvent ae)


{
if(ae.getSource()==compose)
{
this.dispose();
ComposePage cp=new ComposePage();
cp.setSize(1035,790);
cp.setVisible(true);
}

if(ae.getSource()==breakmsg)
{
this.dispose();
BreakPage bp=new BreakPage();
bp.setSize(1035,790);
bp.setVisible(true);
}
}

public static void main(String args[])


{
Home h=new Home();
h.setSize(1035,790);
h.setVisible(true);

}
}

ComposePage.Java

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.awt.image.*;
import com.sun.image.codec.jpeg.*;

public class ComposePage extends JFrame implements ActionListener


{
private JLabel
code_label,secret_label,picture_label;
private JTextField
code_text,secret_text,picture_text;
private JButton
picture_load_button,hide_button,home_button;
String
filepath="",secret_code="",secret_info="",user_key="";
Container con=null;
JLabel jl;
byte img_byte[]=new byte[6000];
FileDialog fd;

//////// Variables for creating an image from an


integer array ///////////////////////////

Image img;
Dimension d;
int iw,ih;
int w=10,h=10;
int pix[];
int hist[]=new int[256];
int t[];
int max_hist=0;
boolean ok;
static Image newimg;
int key,k;

ComposePage()
{
super("Compose");
con=getContentPane();
con.setLayout(null);

code_label=new JLabel("Security Code");


code_label.setBounds(230,100,150,50);
code_text=new JTextField(200);
code_text.setBounds(400,100,250,40);
secret_label=new JLabel("Secret Information");
secret_label.setBounds(230,200,150,50);
secret_text=new JTextField(200);
secret_text.setBounds(400,200,250,40);

picture_label=new JLabel("Picture");
picture_label.setBounds(230,300,250,40);
picture_text=new JTextField(200);
picture_text.setBounds(400,300,250,50);
picture_load_button=new JButton("Load");

picture_load_button.setBounds(700,300,150,30);
picture_load_button.addActionListener(this);

hide_button=new JButton("Hide");
hide_button.setBounds(400,400,150,30);
hide_button.addActionListener(this);
home_button=new JButton("Home");
home_button.setBounds(700,400,150,30);
home_button.addActionListener(this);

jl=new JLabel();
jl.setBounds(700,500,150,30);

fd=new FileDialog(new JFrame());

con.add(code_label);
con.add(code_text);
con.add(secret_label);
con.add(secret_text);
con.add(picture_label);
con.add(picture_text);
con.add(picture_load_button);
con.add(hide_button);
con.add(home_button);
//con.add(jl);
}

public void actionPerformed(ActionEvent ae)


{
if(ae.getSource()==picture_load_button)
{
fd.setVisible(true);
filepath=fd.getDirectory()+fd.getFile();
picture_text.setText(filepath);
}else if(ae.getSource()==hide_button)
{
int starflag=0;
secret_code=code_text.getText();
for(int i=0;i<secret_code.length();i++)
{
if(secret_code.charAt(i)=='*')
{
starflag=1;
}
}
if(starflag==0)
{
secret_info=secret_text.getText();
user_key=secret_code+"*"+new
String(""+secret_info.length());
System.out.println("user
key :"+user_key);
String
secret_code_info=user_key+"*"+secret_info+"*";
byte
secret_byte_array[]=secret_code_info.getBytes();
int secret_int_array[]=new
int[secret_byte_array.length];

try{
if(filepath.equals("") &&
(secret_text.getText()).equals(""))

JOptionPane.showMessageDialog(null,"image
and secret info are empty. enter them");
else
if(secret_info.length()==0 && filepath.length()>0)

JOptionPane.showMessageDialog(null,"enter
secret info");
else
if(filepath.length()==0 && (secret_text.getText()).length()>0)
JOptionPane.showMessageDialog(null,"load an
image");
else
{
ImageIcon ic=new
ImageIcon(filepath);

img=ic.getImage();

iw=img.getWidth(null);

ih=img.getHeight(null);
pix=new
int[iw*ih];
t=new int[iw*ih];
PixelGrabber
pg=new PixelGrabber(img,0,0,iw,ih,pix,0,iw);
ColorModel
cm=pg.getColorModel();
int
ww=pg.getWidth();
int
hh=pg.getHeight();
pg.grabPixels();

key=secret_byte_array.length;
int k=key;
int j=0;

for(int
i=0;i<pix.length;i++)
{
if((i
%20)==0 && k>0)
{

secret_int_array[j]=(int)secret_byte_array[j];

System.out.println("user
key :"+secret_int_array[j]);

pix[i]=secret_int_array[j];
j+
+;
k--;
}
}
newimg
=con.createImage(new MemoryImageSource(ww,hh,cm,pix, 0, ww));
jl.setIcon(new
ImageIcon(newimg));

JOptionPane.showMessageDialog(null,"your
secret code: "+user_key+"");

MediaTracker
mediaTracker = new MediaTracker(new Container());

mediaTracker.addImage(newimg, 0);

mediaTracker.waitForID(0);

int thumbWidth =
400;//Integer.parseInt(400);
int thumbHeight =
400;//Integer.parseInt(400);
double
thumbRatio = (double)thumbWidth / (double)thumbHeight;
int imageWidth =
newimg.getWidth(null);
int imageHeight =
newimg.getHeight(null);
double imageRatio
= (double)imageWidth / (double)imageHeight;

if (thumbRatio <
imageRatio)
{

thumbHeight = (int)(thumbWidth / imageRatio);


}
else
{

thumbWidth = (int)(thumbHeight * imageRatio);


}

// draw original
image to thumbnail image object and
// scale it to the
new size on-the-fly
BufferedImage
thumbImage = new BufferedImage(newimg.getWidth(null), newimg.getHeight(null),
BufferedImage.TYPE_INT_RGB);
Graphics2D
graphics2D = thumbImage.createGraphics();

graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);

graphics2D.drawImage(newimg, 0, 0,
newimg.getWidth(null), newimg.getHeight(null), null);
// save thumbnail
image to OUTFILE
File f=new
File("secpic.jpg");

BufferedOutputStream out = new


BufferedOutputStream(new

FileOutputStream(f));

JPEGImageEncoder encoder =
JPEGCodec.createJPEGEncoder(out);

JPEGEncodeParam param = encoder.

getDefaultJPEGEncodeParam(thumbImage);
int quality =
80;//Integer.parseInt(args[4]);
quality =
Math.max(0, Math.min(quality, 100));

param.setQuality((float)quality / 100.0f, false);

encoder.setJPEGEncodeParam(param);

encoder.encode(thumbImage);
out.close();

System.out.println("Done.");
test t=new
test(newimg);

t.setSize(1035,790);
t.setVisible(true);
}
}catch(Exception e)
{
System.out.println(e);

}
}else

JOptionPane.showMessageDialog(null,"Do not
enter '*' in secrect code");
}else
{
this.dispose();
Home h=new Home();
h.setSize(1035,790);
h.setVisible(true);
}
}

public static void main(String args[])


{
ComposePage cp=new ComposePage();
cp.setSize(1035,740);
cp.setVisible(true);
}
}

Test.java
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.awt.image.*;

public class test extends JFrame


{
Image newimg;
test()
{
}
test(Image m)
{
newimg=m;
}
public void paint(Graphics g)
{
g.drawImage(newimg,100,100,null);
}

public static void main(String args[])


{
test bp=new test();
bp.setSize(1035,740);
bp.setVisible(true);
}
}

Breakpage.java
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.awt.image.*;
//import javax.imageio.stream.*;

public class BreakPage extends JFrame implements ActionListener


{
private JLabel code_label,picture_label;
private JTextField code_text,picture_text;
private JButton
picture_load_button,break_button,home_button;
String filepath="",secret_code="",secret_info="";
Container con=null;
JLabel jl;
byte img_byte[]=new byte[6000];
FileDialog fd;

//////// Variables for creating an image from an


integer array ///////////////////////////

Image img;
Dimension d;
int iw,ih;
int w=10,h=10;
int pix[];
int hist[]=new int[256];
int t[];
int max_hist=0;
boolean ok;
Image newimg;
int key,k;
String user_key="";
BreakPage()
{
super("Break");
con=getContentPane();
con.setLayout(null);

code_label=new JLabel("Security Code");


code_label.setBounds(230,200,150,50);
code_text=new JTextField(200);
code_text.setBounds(400,200,250,40);

picture_label=new JLabel("Picture");
picture_label.setBounds(230,300,250,40);
picture_text=new JTextField(200);
picture_text.setBounds(400,300,250,50);
picture_load_button=new JButton("Load");

picture_load_button.setBounds(700,300,150,30);
picture_load_button.addActionListener(this);

break_button=new JButton("Break");
break_button.setBounds(400,400,150,30);
break_button.addActionListener(this);
home_button=new JButton("Home");
home_button.setBounds(700,400,150,30);
home_button.addActionListener(this);

jl=new JLabel();
jl.setBounds(700,500,150,30);

fd=new FileDialog(new JFrame());

con.add(code_label);
con.add(code_text);
con.add(picture_label);
con.add(picture_text);
con.add(picture_load_button);
con.add(break_button);
con.add(home_button);
con.add(jl);
}

public void actionPerformed(ActionEvent ae)


{
if(ae.getSource()==picture_load_button)
{
fd.setVisible(true);
filepath=fd.getDirectory()+fd.getFile();
picture_text.setText(filepath);
}else if(ae.getSource()==break_button)
{
String sc=code_text.getText();
int star_flag=0;
String star_value="";
for(int i=0;i<sc.length();i++)
{
if(sc.charAt(i)=='*')
star_flag=1;
if(star_flag==1&& star_flag!=2)
{
i=++i;

star_value=sc.substring(i);
star_flag=2;

}
}
System.out.println("star value
er:"+Integer.parseInt(star_value));
k=sc.length()
+1+Integer.parseInt(star_value);
try{
img=ComposePage.newimg;
key=k;
System.out.println("key ckeck in
temp:"+key);
user_key=sc;

Container con=getContentPane();

iw=img.getWidth(null);
ih=img.getHeight(null);
pix=new int[iw*ih];
t=new int[iw*ih];

PixelGrabber pg=new
PixelGrabber(img,0,0,iw,ih,pix,0,iw);
ColorModel cm=pg.getColorModel();
int ww=pg.getWidth();
int hh=pg.getHeight();
pg.grabPixels();

int secret_check[]=new int[sc.length()];


byte sc_byte[]=sc.getBytes();

for(int i=0;i<sc.length();i++)
secret_check[i]=sc_byte[i];

int secret_info[]=new int[key];


byte b[]=new byte[key];
int j=0,loop=0,flag=0,star2_flag=0;
System.out.println("hi welcome");

for(int i=0;i<pix.length;i++)
{
if((i%20)==0 && k>0 &&
flag==0)
{

System.out.println("one");

if(loop<user_key.length()
&& secret_check[loop]==pix[i] && star2_flag<2)
{

System.out.println("two");

if((char)secret_check[loop]=='*')

{
star2_flag+
+;
}

k--;
loop++;
}else if(star2_flag>=1)
{

System.out.println("else if");

secret_info[j]=pix[i];
b[j]=(byte)pix[i];
System.out.println("secrect pix :"+new
String(""+(char)b[j])+"");
j++;
k--;
}
else
{

System.out.println("star flag :"+star2_flag);

System.out.println("else");
flag=1;
}
}
}
if(flag==0)
{
String s=new String(b);
s=new String(s.substring(1));

System.out.println("secret
information :"+s);
System.out.println("key :"+key);

JOptionPane.showMessageDialog(null,"Secret
Information is : "+s);
}
else

JOptionPane.showMessageDialog(null,"code you
entered is not valid");
newimg =con.createImage(new
MemoryImageSource(ww,hh,cm,pix, 0, ww));
}catch(Exception e)
{
System.out.println(e);
}
}else
{
this.dispose();
Home h=new Home();
h.setSize(1035,790);
h.setVisible(true);
}
}
public static void main(String args[])
{
BreakPage bp=new BreakPage();
bp.setSize(1035,740);
bp.setVisible(true);
}
}

Chapter 7

CONCLUSION

This project provides a GUI, a user friendlier system, where secret information can
easily be hided with in a picture file. It attains all java futures. It is platform
independent so that it can be used in any OS. Thus secret information can be
transferred to the intended user without giving any suspicion to the unintended user.
Chapter 8

Future Enhancement:

Steganography is the science that involves communicating secret data in an


appropriate multimedia carrier, e.g., audio, and video files.
The meaning of Steganography is hiding information and the related
technologies. There is a principal difference between Steganography and Encryption;
however they can meet at some points too. They can be applied together, i.e.
encrypted information can be hidden in addition. To hide something a covering
medium is always needed (Picture, sound track, text or even the structure of a file
system, etc.).

References
Web Sites

 http://www.javaranch.com

 http://forum.java.sun.com
 http://java.sun.com

 http://www.javaworld.com

You might also like