Project Report On IMAGE EDITOR As Partial Fulfillment of Award of Bachelor of Engineering in Computer Engineering Prepared by: 100010107017 : Arpit Shroff 100010107055 : Ishan Desai Guided by: Ms. Soniya M. Hingu A. D. Patel Institute of Technology Vallabh Vidyanagar Gujarat Technological University (December - 2013)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Project Report
On
IMAGE EDITOR
As
Partial Fulfillment of Award of
Bachelor of Engineering in
Computer Engineering
Prepared by:
100010107017 : Arpit Shroff
100010107055 : Ishan Desai
Guided by:
Ms. Soniya M. Hingu
A. D. Patel Institute of Technology
Vallabh Vidyanagar
Gujarat Technological University
(December - 2013)
Image Editor Page ii
A. D. Patel Institute of Technology
Department of Electrical Engineering
CERTIFICATE
This is to that Arpit Shrof (100010107017) and Ishan Desai ((100010107055) of
final year Computer Engineering have satisfactory completed their project work
entitled “Image Editor” in the academic year 2013-14 for the partial fulfillment of
the award of the Bachelor of Engineering in Computer Engineering at Gujarat
Technological University, Gujarat, India.
Date:
Project Guide Head of the Department
Ms. Soniya M. Hingu Dr. Ramji M. Makwana
Image Editor Page iii
ACKNOWLEDGEMENT
It is indeed a great pleasure to express our sincere thanks and gratitude to all those who helped us
during the development of this project. The success we have got in the accomplishment of the
project work is not only due to our efforts. In fact, we stand on the shoulders of many people. So,
with a great pleasure we would like to take this opportunity to express our gratitude towards all
the individuals who have helped and inspired us in our project work.
Our project at A. D. Patel Institute of Technology – New VallabhVidhyanagar has been the
perfect stepping stone into the world of professionals. We acknowledge with deep sense of
gratitude, the guidance and support received from Prof. Soniya Hingu (Project Guide) and
Prof. Bhagirath Prajapati who approved our project, had faith in it and also for his critical
evaluation and suggestion regarding the project at every step. We are also thankful to all the
faculty of our department for helping us directly or indirectly in our project. We are also grateful
to have the valuable assistance of our lab assistants for constantly providing us all the tools and
software necessary for our project to be implemented whenever needed.
Although there may be many who remain unacknowledged in this humble note of gratitude,
there are none who remain unappreciated.
Arpit Shroff(100010107017)
Ishan Desai(100010107055)
Image Editor Page iv
TABLE OF CONTENTS
Chapter 1 2
1.1 Purpose 2
1.2 Objective 2
1.3 Resources at hand 3
1.4 Project Definition 3
1.5 Scope of the project 4
1.6 Technical Feasibility 5
1.7 Time and Operational Feasibility 6
1.8 Economic Feasibility 6
1.9 Some Preplanned Features 7
1.10 Project Plan 8
1.11 Build up to the project 9
Chapter 2 12
2.1. Introduction to Java 12
2.2. Features of Java: 13
2.3. Advantages of Java: 13
2.4. JAVA PROGRAM EXECUTION PROCESS 14
2.5. API(Application Programming Interface): 15
2.6. ACCESS Modifiers & Variables: 16
2.7. JFC(Java Foundation Class): 18
2.8. The AWT (Abstract Windows Toolkit): 21
2.9. The SWING: 21
2.10. NetBeans 24
Chapter 3 29
3.1 An Overview of UML: 29
3.2 Low level diagram of the Application 30
3.3 Class Diagram Of the Application 31
3.4 Use case Diagram for the Application 35
3.5 Activity Diagram 40
3.6 Screen Layouts 42
Image Editor Page v
Chapter 4 47
4.1 Classes Used. 47
4.2 Some General Algorithms and Their Implementation 51 4.2.1 Algorithm for Opening a Document:- 51
4.2.2. Algorithm for saving a document 54
4.2.3 Algorithm For General Annotations 57
4.2.4 Algorithm for Database Connection: 57
4.2.5 Algorithm for Adding the Records: 58
4.2.6 Algorithm for Viewing Records: 59
4.2.7 Algorithm for Brightness: 60
4.2.8 Algorithm for Grayscale: 61
4.2.9 Algorithm for Redeye View: 61
4.2.10 Algorithm for Invert: 62
4.2.11 Algorithm for Rotate 63
Chapter 5 66
5.1 Testing 66
5.2 Testing And Debugging 67
Chapter 6 71
6.1 USER MANUAL 71
Chapter 7 75
7.1 Future Enhancement 75
Conclusion 76
References and Bibliography
767
Image Editor Page 1
Chapter 1
INTRODUCTION
Image Editor Page 2
Chapter 1
INTRODUCTION
1.1 Purpose
This document describes the external behavior of the application. It also describes non-functional
requirements, design constraints and other factors necessary to provide a complete and comprehensive
description of the requirements for the software. The intended behavior of the system is clearly
explained so that the communication gaps do not lead to misinterpretations of actual requirements.
The requirements specified in this document are to be translated without any further assumptions from
the analysts or developers side to consequently lead to the system with desired functionalities.
1.2 Objective
In computer graphics, graphics software or image editing software is a program or collection of
programs that enable a person to open, save and edit an image. The basic editing features generally
Includes crop, effects, resizing, adding frames and many more.
The aim of this project is to create a software application which can be used for the processing of
various images (all generally used formats). The application should be able to support and open all
possible files which can possibly be supported, and also process the same. Viewing of this processed
and the original images should be facilitated.
Our application provides an editor to the user for viewing and performing simple manipulations on
images.
It also provides some basic manipulations like inverting the pixels in an image; transforming an
image; zooming in and out for detailed view; rotating and image; swapping the RGB components;
performing fast fourier transforms for a sharper and more accurate image and to fit the image to the
window size.
Image Editor Page 3
Our aim would be to create an application of the likes of Picasa or Instagram or Adobe Photoshop.
We’ll basically implement all the normal and simple functions available in such applications and
would try to merge the functions of all these well-established image editors into our application.
We will also establish a database most probably in MS ACCESS which will keep track of the images
being altered. The information that it would be holding includes the location of the image, Size of the
image, Type of the image, when the changes were made and stored i.e the Date and Time.
1.3 Resources at hand
A Laptop powered with Pentium-Core i5 processor was used for the development of the project.
The project had to be developed in either Java or C++, so after studying the requirements of the
project, a few discussions with the professionals and preliminary analysis it was concluded that it
should be developed in Java.
For this a Guide/Tutor was appointed who was to guide the team during the entire semester.
A mini-library for books and CD’s was made available so as to refer the contents whenever required.
Various online forums such as stackoverflow.com and many other were referred to develop the
project more efficiently.
1.4 Project Definition
The aim of this project is to create a software application which can be used for the processing of
various images (all generally used formats). The application should be able to support and open all
possible files which can possibly be supported, and also process the same. Viewing of this processed
and the original images should be facilitated.
Image Editor Page 4
Our application provides an editor to the user for viewing and performing simple manipulations on
images. It also provides some basic manipulations like inverting the pixels in an image; transforming
an image; zooming in and out for detailed view; rotating and image; swapping the RGB components;
performing fast fourier transforms for a sharper and more accurate image and to fit the image to the
window size.
The user interface is simple and appropriate. The GUI is simple and easy to understand. It has been
developed keeping in mind an average user.
The application developed is not an entirely new concept. It is inspired form different image editors
available in the market – an image viewer which supports various formats for viewing and editing
purposes.
This application is in a way better that it supports all the file formats that are supported by the jdk1.4.2
kit.
The application doesn’t modify the source document opened but it creates a new folder for each user
in which all the information of the image is stored and can be accessed using database with the help of
MS ACCESS.
As a part of look and feel, a few eye-soothing themes have also been added to the application.
1.5 Scope of the project
Scope of this project is to provide a basic image editor in a way which is able to perform annotations
on the images without modifying the original images in a layered form. The project has been dealt
with as a user-application so as to know each and every requirements of the user and trying to
complete each of those within the limited time span during the entire project. The DMS can be
developed on the basis of this application by attaching this application as a plug in module in the
system. The project can be extended to a variety of functionalities related to the document editing and
management.
Image Editor Page 5
This application can right now provide basic annotating facilities.
Goals: The sole aim of this project was to provide an application which is able to support images of
various formats available and annotate them as per the requirements and save them in a way so that
the original document opened can be modified/overwritten.
1.6 Technical Feasibility
The project is technically feasible in the sense that it uses Java as a tool to develop this project.
Taking the feasibility resource wise, actually the project was to be developed in either C++ or Java.
We know Java is a very powerful independent tool. To develop this application, which is basically
inspired form Kodak IMG Viewer Java was the choice because of a few factors. One of them is the
GUI (Graphical User Interface). Obviously the look and feel which is supported by Java was not
going to be the case with C++. Thus this was a major consideration.
Looking at the requirements another factor which highlights is the support for various electronic file
formats which Java does through its well-structured and well-defined sets of packages; and if C++ is
used, a code has to be written for each of the file formats to be supported thus making it a heavy task.
Thus Java had to be considered. Java APIs for various manipulations on images also add to the
flexibility to develop image-editing applications.
Another reason being the layer which is a stronghold of the project had to be implemented. And
adding to it, the different forms of annotations which were to be performed on this layer was to be
done. This could have been a mind-blowing job in C++, but Java makes it simpler as it has a set of
methods which can handle various events by just implementing them e.g. the mouse event handling
through co-ordinate manipulation which was a bit difficult in C++. Thus the ultimate choice was Java
seeing its vast use all over and its advanced image handling capabilities.
Image Editor Page 6
1.7 Time and Operational Feasibility
Time is one of the major considerations during the project development. The project loses its value
even if it is sound but not completed within its required time duration.
As far as this project is concerned, seeing the requirements the project definitely doesn’t seem to get
completed within the time duration allotted to us. But we have tried our best to implement what was
feasible within the time limit
The application operationally is very simple because it doesn’t have much complexity in its
menus/operations. All of the menus have simple and understandable functionality with most of the
functions available as a button on the toolbar. The application, as it is developed in Java, can be
considered platform independent and would require only runtime if the operating system platform
changes. And the design structure of the coding is very much tried to be made user-friendly so that if
the project is extended further it would be easy for a new comer. Various plug-in modules can also be
included e.g. for the support of a file format, by importing their corresponding packages from the
source.
1.8 Economic Feasibility
As the project is not live/ real-time, there is no need to mention this factor of concern but still we
would like to mention them. Economically also this project seems to be feasible in the sense that the
major requirement is Java which is available absolutely free of cost.
Adding further, if any further requirement arises for say format support APIs for a specific task they
are also made available on the net. Also third party APIs and plugging can contribute.
Company also sees this economically feasible because the project can be easily extended as the
primary platform, GUI is ready. Thus GUI designing and the basic facilities like that of paint are also
ready.
Image Editor Page 7
1.9 Some Preplanned Features
• File tab
This tab will generally consist of Opening, closing and saving the image. This tab may also consist
renaming and deleting the image from the program so that a new image can be opened along with
an Exit option.
• Edit tab
This tab will generally include the copy and paste functions along with undo and redo effects
options.
• Resize tab
This tab will generally deal with the resizing of image that is opened in the program. Such features
will include zooming the image to a particular percentage. Halving or doubling the image. It will
also include the option of fit to window. This resize tab will also include rotate left or right option.
• Simple Edits
Various features like crop, straighten, auto colour, contrast, text, auto brightness, saturation, hue.
• Slide Show Feature
We will also try to implement a slide show feature in our program. Our program will include a
previous and next option.
• Editing Themes
We can add various editing themes which are normally provided by various apps available such as
o Sharpen
o Sepia
o Black and white
o Exposure
o GreyScale
o Invert
Image Editor Page 8
• Pen tools
The Program will also consists of pen tools such that it will allow us to write what we desire and
erase what we desire. Such tools are mostly helpful for storing memories of a picture or signing a
picture.
We will also provide an Insert text dialog box so that we can add the desired text in a desired font.
1.10 Project Plan
List of major activities
The major activities during the entire project are as follows:
Study of Java and requirement analysis
GUI (Graphical User Interface) designing
Coding as per the requirements
Prototypes presented
Estimated time duration
The project as per the requirements was above the duration of the semester as the complete project
requires more than six month.
According to the requirements which were briefed to us, we had estimated that around 1-2 weeks
of studying the Development Tool would be sufficient.
Then the GUI designing was estimated around 1 or 1 ½ weeks for a complete user interface.
Image Editor Page 9
Then around 6 weeks of extensive coding was estimated to create a complete working model
which would provide annotations, and all basic image editing facilities and support for file formats
as many as possible.
The testing and debugging was estimated for 1 week. This part of project was estimated to be less
because the project was not to be used live but was to be developed / extended further as and when
possible.
The prototypes as and when became ready during the coding time were presented.
And of course documentation is not going to be a well estimated because it is going to be a
continuous work throughout the project, although a last 1 or 1½ weeks were dedicated to this part
of the project.
1.11 Build up to the project
Fact Finding
As the application is unique in itself, lot of exemplary documents and applications had to be studied.
A few of them will be described during this topic.
The study of the requirements of the application was done after a few meetings with the Head of our
project.
Meetings with the Faculties:
During the initial meetings with the head, the entire definition of the project was discussed at a stretch
in order to make the requirements’ study easier. Many references were pointed out by him whom had
to be studied which would sketch out a broad outline of the definition. Initially some of the Image
Viewer Soft wares were also used for reference as it was a probable feature of the project if the time
permitted. For this, it was necessary to know that what actually basically document management
means.
Image Editor Page 10
In order to get a taste of this a brief description of the Image Viewer and how it works will be
discussed below. The application was to be developed either in Java or C++. And ultimately seeing
the facilities provided Java it was decided to work in Java.
Discussion with the Project Guide:
The requirements were briefed before the guide and then we had some meetings for an elaborated
overview of the features which were must in the application. The first and the foremost task to be
carried out were to learn JAVA which has been used to develop this project.
The basic requirement was to implement the layered format of the annotated document. Each object to
be drawn was just like that of in Microsoft Paint but was not to be merged with the document and the
identification of each of them should be possible and that too according to the users.
Another important feature was the support of the electronic file formats. For this the guide gave a few
suggestions and a package in Java – image io which is widely used to support the commonly used
formats. Along with this the plugin packages are also available which can be imported to increase the
compatibility to support more file formats.
The requirements of the application were as follows:-
To provide flexible annotation support.
To implement the object drawing on the layer so as not to modify the source.
To provide identification of each object drawn.
To provide basic image editing facility such as zooming, blurring, sharpening, flipping the image
to left and right, etc...
To provide as many electronic file formats support as possible.
Image Editor Page 11
Chapter 2
INTRODUCTION TO
JAVA
Image Editor Page 12
Chapter 2
INTRODUCTION TO JAVA
2.1. Introduction to Java
Java has become a popular programming language today. As a part of introduction, some of its
important features will be highlighted in this section. As Java can be described completely here is an
overview of Java in relevance to the project.
Java is one of the first programming languages to consider security as a part of its design. Its compiler,
interpreter and runtime environment were developed in such a way so as to reduce the risk of loss of
data and program integrity and damage to system users.
The Java is designed in such a way so as to eliminate manual memory allocation and deallocation.
Memory in Java is automatically garbage collected. So never worry about the memory leaks!
Introduction of true array eliminated the pointer arithmetic. You never have to worry about
overwriting a key area of memory because of an off-by-one error when working with a pointer.
Elimination of multiple inheritances and replacing it with a new notion of Interface was another
distinguishing feature. Interfaces give what one wants from multiple inheritances, without the
complexities that come with managing multiple inheritance hierarchies.
It also offers same Application Programmer Interface (API) on all platforms.
The Java Language specification mandates several things that are normally left to the discretion of the
compiler writer. By requiring that operands which are evaluated strictly in a left to right order and
stipulating the size of all the primitive types ( int 32 bits, doubles 64 bits, etc…), Java offers not just
program portability but identical program behavior on different system. In other words, not only does
Image Editor Page 13
the program run everywhere, but it will get the same arithmetic results everywhere, despite of
different hardware models of arithmetic and overflow.
The class path is the path that the Java runtime environment searches for classes and other resource
files. Java uses the Unicode Character-set which is a 16-bit superset of ASCII. Unicode can represent
the symbols in most of the alphabets in the world.
2.2. Features of Java:
Java was designed to meet all the real world requirements with its key features as stated below,
Simple and Powerful
Object-oriented
Robust
Secure
Portable
Architecturally neutral
Interpreted and High Performance
Multithreaded
Dynamic and Distributed
2.3. Advantages of Java:
Platform independence:
One of the obvious advantage is a run-time library that hopes to provide platform independence;
same code can be used on windows 98, NT, Solaris, Unix, Macintosh etc…
Others include:
Object-orientation: Everything in Java except for a few basic types like numbers is an object thus
making it far easier to turn out bug-free code using Java than using C++.
Security, reliability, simplicity, standardization, rapid code generation, ease of documentation and
maintenance (when doc comments and the javadoc tool are used) has been the reason for its
increasing popularity.
Image Editor Page 14
2.4. JAVA PROGRAM EXECUTION PROCESS
Java source code compiles into portable byte-codes that require an interpreter to execute them. For
applets, this task is handled by the browser. For GUI and command-line applications, the Java
interpreter program is required to execute the application. A variety of applications can be built in Java
like applets, GUI applications, command-line applications, servlets, packages, embedded
applications,etc…
Component Diagram
Image Editor Page 15
The heart of Java is the Java Virtual Machine (JVM). It can be termed as a virtual computer residing
in the memory. The JVM enables the Java programs to be executed on a variety of platforms as
opposed to only the one platform for which the code is compiled. JVM is the very reason why Java is
portable. Java source code is compiled to the byte code level as compared to the bit code level. So
when the .java extension file is compiled using the compiler javac a new .class extension file is
generated which is actually byte code format of the corresponding java file. The size of an address in
the JVM is 32 bits so it can address up to 4G memory. There is a provision of a heap which is a
collection of memory from which the class instances are allocated.
The runtime environment keeps the track of references to each object on the heap and automatically
frees the memory occupied by objects which are no longer referenced.
The Java 2 SDK, Standard Edition, contains two implementations of the Java virtual machine (VM).
Java Hotspot Client VM
It is tuned for best performance when running applications in a client environment by reducing
application start-up time and memory footprint.
Java Hotspot Server VM
The Java Hotspot Server VM is designed for maximum program execution speed for applications
running in a server environment. The Java Hotspot Server VM is invoked by using the -server
command-line option when launching an application, as in java -server MyApp.
2.5. API(Application Programming Interface):
The Java Application Programming Interface API is a set of classes developed by Sun for use with the
Java language. It is designed to assist in developing one’s own classes, applications or the applets.
With these set of classes ready you can write an application in Java which is a few lines long and at
the same time easy to debug. The classes in API of Java are grouped into the Packages each of which
may have several classes and interfaces. Furthermore, each of these items may also have several
Image Editor Page 16
properties, such as fields and/or methods. Some of the major API’s include the Core API, which has
important packages like the applet, awt, data transfer, event, image, beans, math, net, sql, util, text and
the list goes on.
The other is the Standard Extension API (server API) which provides the capability of the server-side
programming.
Then is the Java 3D API which provides the capability to create three-dimensional graphics
applications as it consists of classes and interfaces that support the 3D objects and transformations.
Then are the Speech API, Telephony API, and Security API, Java Management API etc…
The Security API also provides application-level security by giving the cryptographic support which
can be obtained by having a separate add-on, the Java Cryptography Extension (JCE). And as we
know that as the technology advances more and more API’s and packages can be incorporated into it
to make Java feel richer in every way.
2.6. ACCESS Modifiers & Variables:
There are several keywords that control the visibility of a class and the members of a class. The table
below explains the access modifiers – private, protected, public and no modifier. There are plenty of
other keywords – static, final, abstract, native and so on; that affect other things about a member class.
Sometimes two keywords can also occur together, such as “static final”.
One can have only one access modifier though, if one leaves it off, then the default is “the field can be
accessed by anything in the same package”. In general, the fields should be given a more restricted
visibility that still makes it possible for them to work. Another important thing to be noted is that
making any fields public without any good reason destroys encapsulation.
Image Editor Page 17
Declaration Keyword
Private No
modifier
Protected Public
Same class Yes Yes Yes Yes
Same package subclass No Yes Yes Yes
Same package non-subclass No Yes Yes Yes
Different package subclass No No Yes Yes
Different package non-subclass No No No Yes
Private means that the members are not accessible outside the current class in which it is declared.
Making a constructor private prevents the class being instantiated. Making a method private means
that it can only be called from within the class.
No modifier means members are accessible in classes in the same package only. A class can be given
package access or public class.
Protected means members are accessible in the package and in subclasses of this class. Note that
protected is less protected than the default of package access.
Public means members are accessible anywhere the class is accessible. A class can be given package
access or public access. These keywords can also be used for the variables.
Variables are the locations in the memory that can hold values. Thus before assigning any value to a
variable, it must be declared.
Instance variables are used to define attributes or the state of a particular object. These are used to
store information needed by multiple methods in the objects.
Image Editor Page 18
Local variables are used inside blocks as counters or in methods as temporary variables. Once the
block or the method is executed, the variable ceases to exist. The local variables are used to store
information needed by a single method.
Class variables are global to a class and to all the instances of the class. They are used to communicate
between different objects.
Benefits of Java mainly include the rich set of packages that it provides and which come bundled with
the Java Development Kit (JDK) from Sun Microsystems. These prewritten objects make it easy to
run quickly because you do not need to develop the functionality they provide and the source code is
available for all.
2.7. JFC(Java Foundation Class):
It was very difficult to create a truly abstract system which would work on all the systems. So the
developers decided to build a different kind of system which would rely on fairly one common
component- a Container (a parent of Panel). Because a container is uniform for all systems, you can
paint and draw on one without encountering platform dependencies. So there came the JFC (Java
Foundation Classes). The JFC system is based on two primary things: first, the Container and Frame
components from AWT and second the JDK event model. JFC’s entire system is based on a design
concept called Model View Control, or MVC. The MVC system Separates the various portions of
each interface component into three separate components.
Each of these components has its own set of requirements and responsibilities.
Model: is responsible for knowing and maintaining the state of the component. eg.Buttons.
View: is responsible for all display aspects of the component. This primarily involves the paint ()
method, but also means that the view must know exactly what should be painted. eg. Rollover over
the icon.
Image Editor Page 19
Control: manages the actual events that are received by the component. These events can be either
from the user (mouse-click) or from the system (timer event). The control must figure out what to do
with this event and inform the model, view and other appropriate listeners.
Because the communication between the view and the control is very complicated, for the most part
JFC has combined them into a single component called a delegate resulting into a delegation-event
model as shown in fig. below.
The approach of handling the events is based on the following concept: a source generates an event
and sends it to one or more listeners. And the listener waits until it receives the event. Once received,
the listener processes the event and then returns.
The advantage of this design is that the application logic that processes events is clearly separated
form the user interface logic that generates those events. Thus a user interface is able to “delegate” the
processing of an event to a separate piece of code. Here the listeners must register with a source in
order to receive an event notification. This provides a benefit that the notifications are sent only to
listeners that want to receive them. Here are some important terms defined:
Events: It is an object that describes a state change in a source. It is generally generated as a result of
user interacting with any of the elements of the GUI (Graphical User Interface).
Image Editor Page 20
Source: It is an object that generates an event. This occurs when the internal state of that object
changes in some way.
Event Listeners: It is an object that is notified when an event occurs provided i) the event is registered
with one or more sources to receive notifications about specific types of events ii) it must implement
methods to receive and process these notifications. The methods that receive and process events are
defined in a set of interfaces found in java.awt.event.
Event Classes: These represent the events that are at the core of Java’s event handling mechanism.
The main event classes in the package for event handling are Action Event, Adjustment Event,