Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Photo Editor: A CS101 Computer Science Project, Papers of Computer Science

The development of a photo editor program as a final project for cs101 computer science i. The editor has four capabilities: black and white, lighter, darker, and negative. The program takes a user-selected photograph and changes the rgb values of each pixel to provide a new image. The challenges faced during development and potential improvements.

Typology: Papers

Pre 2010

Uploaded on 08/26/2009

koofers-user-6d3
koofers-user-6d3 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Photo Editor
[Report]
Christopher Thompson
May 12, 2008
CS101 Computer Science I
pf3
pf4
pf5

Partial preview of the text

Download Photo Editor: A CS101 Computer Science Project and more Papers Computer Science in PDF only on Docsity!

Photo Editor

[Report]

Christopher Thompson

May 12, 2008

CS101 Computer Science I

ABSTRACT

Many times, people seek the opportunity to edit a photograph so that they can see the

picture in a different way. In the making for the past three weeks, this photo editor has

been designed to enhance a photograph. There are four different capabilities of this

editor program: black and white, lighter, darker, and negative. This program takes a

picture of your choosing and changes the value of each pixel in order to provide you with

a new photograph that will be lighter, darker, black and white, or negative.

INTRODUCTION

This picture program is part of my final project for CS101. Since we did not cover GUI

interfaces or picture processing in class, I began researching both about a month ago and

started writing the code about three weeks ago. Naturally, I ran into problems with

pulling out the pixels and their RGB components. However, upon learning that I had to

shift in order to get each of those components, my program began to work smoothly. In

order to improve this program, I believe it should have a save function along with other

additional features, such as resizing the picture.

METHOD

This program can be broken down into three sections: constructor, action event caller,

and the functions. The first thing that this program does is call up the photo class which

acts as a constructor. In this class, the program analyzes the input of the user’s argument

and finds the picture file that was specified. Next, the program takes the picture and sets

it as a buffered image so that they RGB values could be extracted and used by the

functions. The image class is great for basic image tasks, but is extremely limited in its

capabilities. By using BufferedImage, a subclass of Image, the user and programmer

have the ability to access much more image data. In this program, it is necessary to

access the different color components of each pixel. The most common type of color

model is the RGB model, which says that each pixel is comprised of a Red, Green and

Blue component, each between the values of 0 and 255. By changing the values of each

of these components, the color of the pixel changes. A two dimensional array is then

created in a for loop in order to hold the RGB values of each individual pixel. Also in the

constructor is the creation of the buttons and the label to hold the picture. Since I created

the frame, panel holding the buttons and the picture in the constructor, the only thing that

has to change once a button is pushed, is the new picture.

Once a button is pressed, the action listener calls upon the function that correlates to that

button. Part of the action event code follows:

public void actionPerformed(ActionEvent pushed) { if (pushed.getSource() == button1) { blackwhite(); }

This is the original photo.

This is the photo after the Black & White button is pressed.

This is the photo after the Brighter button is pushed.

This is the photo after the Darker button is pressed.

This is the photo after the Negative button is pressed.