Copyright © 2009 Curt Hill The Picture Object Getting and displaying.

Slides:



Advertisements
Similar presentations
Put your photos into PowerPoint Insert, crop, and format pictures Youve got photos and you want to display them in a slide show. The first thing you need.
Advertisements

Information Representation
Color COM 366 Web Design & Production. RGB color Amount of light in each channel Closer to 255, whiter color gets Every color has value for red,
Graphics CS 121 Concepts of Computing II. What is a graphic? n A rectangular image. n Stored in a file of its own, or … … embedded in another data file.
Introduction to Computer Graphics
Information Technology Services North Dakota State University Lorna Olsen Get the Best Digital Images Possible What’s it all about anyway?
File Formats By Jack Turner. Raster (Bitmap) Raster or bitmap is a dot matrix data structure, containing columns of dots and rows, of a graphics image.
Nat 4/5 - Software Design and Development – Low Level Operations - 1 National 4/5 – Computing Science Information Systems Design and Development Media.
Understanding Web Graphics Web Design Section 5-4 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
1 Ethics of Computing MONT 113G, Spring 2012 Session 11 Graphics on the Web Limits of Computer Science.
CHAPTER 4 Images XNA Game Studio 4.0. Objectives Find out how the Content Manager lets you add pictures to Microsoft XNA games. Discover how pictures.
Lecture 4 - Introduction to Computer Graphics
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
Image Storage Bitmapped Graphics – in which an image is represented as a collection of dots Vector Graphics – in which an image is represented as a set.
Presentation Design: Graphics. More About Color “Bit depth” of colors -- This is based on the smallest unit of information that a computer understands.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 14 Introduction to Computer Graphics.
What is Digital Photography? Lesson One Mrs. Johnson Winter/Spring 2012 Digital Photography Course.
Bit-Mapped Graphic Data: Input (Capture) Hardware Multimedia – Section 2.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
1 Ethics of Computing MONT 113G, Spring 2012 Session 10 HTML Tables Graphics on the Web.
Copyright © Curt Hill Turtles The beginning of media computation.
Section 8.1 Create a custom theme Design a color scheme Use shared borders Section 8.2 Identify types of graphics Identify and compare graphic formats.
Vocabulary Words. 2-stage shutter release is a shutter release, that when pressed halfway, it activates the autofocus and the light meter of the camera,
Information Processes and Technology Multimedia: Graphics.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 3 This presentation © 2004, MacAvon Media Productions Introduction to Computer Graphics.
Working with Images William Pegram April 1, 2013.
Image Representation. Digital Cameras Scanned Film & Photographs Digitized TV Signals Computer Graphics Radar & Sonar Medical Imaging Devices (X-Ray,
ManipulatingPictures-Mod6-part11 Manipulating Pictures, Arrays, and Loops part 1 Barb Ericson Georgia Institute of Technology.
Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the.
Graphics & Images What File Format Do I Use?. Graphics & Images …..are visual images presented on some form of media (drawings, print, web, digital video)
FILE TYPES FOR WEB DESIGN 1 HOW SHOULD I SAVE?. GRAPHICS INTERCHANGE FORMAT (GIF) Best used for flat-color, sharp-edged art or text Clip art, logos Compression.
Raster Graphics 2.01 Investigate graphic image design.
File Types. Terms Multimedia- the integration of text, sound, video and/or animation into a document Letters, brochures, newsletters, web pages or presentations.
An bitmapped image on the computer is represented by many pixels. A pixel is basically a dot on the computer screen.
Editing Images for the Web. Optimization/Compression Graphics optimization is important for fast web page display.
Digital Images are represented by manipulating this…
POWERPOINT PLUS 11/17/07 Class Notes. WHAT IS A PIXEL A pixel is a number that represents the intensity of light at a square spot in the picture. Pixels.
Introduction to Images & Graphics JMA260. Objectives Images introduction Photoshop.
Lesson 2: Introduction to Digital Imaging Digital Photography MITSAA IAP 2003 Rob Zehner.
Image File Formats By Dr. Rajeev Srivastava 1. Image File Formats Header and Image data. A typical image file format contains two fields namely Dr. Rajeev.
HTTP transaction with Graphics HTML file + two graphics files.
Resources used for marketing the product By Jamie Colclough.
Image File Formats Harrow Computer Club – Wed, 1 Dec 2010 Bob Watson MA CMath MIMA MBCS.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
Copyright © Curt Hill Further Picture Manipulation Considering position.
Image Editing Vocabulary Words Pioneer Library System Norman Public Library Nancy Rimassa, Trainer Thanks to Wikipedia ( help.
WEB GRAPHICS EXPLORING COMPUTER SCIENCE - LESSON 3-4.
Graphics and Image Data Representations 1. Q1 How images are represented in a computer system? 2.
Section 8.1 Section 8.2 Create a custom theme Design a color scheme
2.01 Understand Digital Raster Graphics
2.01 Understand Digital Raster Graphics
DIGITAL MEDIA FOUNDATIONS
Getting and displaying
2.01 Understand Digital Raster Graphics
Image Formats.
Sci Vis I Exam Review Unit 6 File Formats.
2.01 Investigate graphic image design.
Chapter 3 Image Files © 2017 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Digital Images.
Digital imaging.
1.01 Investigate graphic types and file formats.
Introduction to Computer Graphics
Data Representation.
Representing Images 2.6 – Data Representation.
2.01 Understand Digital Raster Graphics
2.01 Investigate graphic image design.
Other displays Saving Arrays Using fors to process
2.01 Understand Digital Raster Graphics
2.01 Investigate graphic image design.
2.01 Investigate graphic image design.
Presentation transcript:

Copyright © 2009 Curt Hill The Picture Object Getting and displaying

How are pictures shown? Any image displayed on a computer is a series of pixels Pixel is an abbreviation of picture elements It is a dot of a particular color and intensity Each pixel has at least three components: –Red, Green, Blue –All of which are in the range Copyright © 2009 Curt Hill

How are pictures organized? Pictures are always lines of pixels –The lines are horizontal The pictures are always rectangular –Each line is same length Monitors are generally in the 1024 by 760 size –May be higher or lower depending on age and expense Digital cameras usually make much larger images Copyright © 2009 Curt Hill

How are pictures stored? There are many formats JPEG – Joint Photograph Expert Group –Usually have a.JPG extension on the file GIF – Graphic Interchange Format –Owned by CompuServe –PNG is the public domain alternative Bitmap – Native format for most PCs Copyright © 2009 Curt Hill

Storage Most file formats compress the image in some way Bitmaps generally the least JPGs generally the best GIFs are best for line drawings Compression may be lossless or lossy –JPG is lossy but the amount of loss is a parameter to the compression process Copyright © 2009 Curt Hill

Objects We will use the Java object named Picture and a few others It will allows us to read from disk and write to disk JPGs We will not have to worry about compression and other details We will be able to access individual pixels as well as display the picture easily Copyright © 2009 Curt Hill

Constructors Pictures like all other objects need a constructor Recall there were two Turtle constructors with different parameters One took just the World object The other took an initial location and the World object We will have multiple constructors with Picture as well Copyright © 2009 Curt Hill

Picture Constructors There is a default constructor: Picture pix = new Picture(); This creates a picture object but does not initialize it The more helpful is the String constructor: Picture(String fileName); –The string is the file name of the picture –This could be a constant string or we could find it Copyright © 2009 Curt Hill

View The string constructor makes the object It then loads the actual picture into memory It does not display it This is done with the show method: p.show(); It creates a new window to display the picture See the example program Copyright © 2009 Curt Hill

Example Copyright © 2009 Curt Hill public class PictureDemo1{ public static void main(String [] a){ Picture p = new Picture( “C:/intro-prog-java/mediasources/barbara.jpg"); p.show(); }

What’s wrong with this picture? The problem is the constant file name Every time we run the program we get the same file What we would really like is the ability to choose any picture file on the disk We do this with FileChooser object Copyright © 2009 Curt Hill

FileChooser FileChooser is an existing object Produces a common dialog box screen that makes it easy to choose a file The static method of the object that you want is called pickAFile This returns a string This can then be given to the Picture constructor Copyright © 2009 Curt Hill

The Program Copyright © 2009 Curt Hill

Started Copyright © 2009 Curt Hill

Display Copyright © 2009 Curt Hill

Commentary The String declaration and call to FileChooser was made two lines so PowerPoint would not wrap It could be: String fileName = FileChooser.pickAFile(); Displaying pictures is that easy Copyright © 2009 Curt Hill

Now What? In order to do picture manipulation we need flow of control This includes loops and conditionals This is our next major topic (chapter 4) However, a turtle can drop a picture onto its world Copyright © 2009 Curt Hill

Turtles and Pictures A turtle can place a picture on a world with the drop method This method takes a Picture as a parameter Something like this: Turtle t = new Turtle … Picture p = new Picture … … t.drop(p); Copyright © 2009 Curt Hill

Commentary The picture is not resized If the picture is too large it will be clipped by the world The orientation of the picture matches the turtle –It will be shown tilted at the same angle as the turtle Consider the following program Copyright © 2009 Curt Hill

Example program Copyright © 2009 Curt Hill public class PictureDemo1{ public static void main(String [] a){ String fileName; fileName = FileChooser.pickAFile(); Picture p = new Picture(fileName); World w = new World(); Turtle yertle = new Turtle(w); yertle.forward(50); yertle.drop(p); yertle.forward(50); yertle.turn(-50); yertle.drop(p); }

Display Copyright © 2009 Curt Hill

FileChooser Again FileChooser is a wrapper for the JFileChooser object –Part of the standard Java package –FileChooser is made to be easier to use One problem with FileChooser is that it starts at the same directory –Depends on the system –In Windows usually MyDocuments The directory to start in can be changed Copyright © 2009 Curt Hill

setMediaPath A method that tells FileChooser where to start Example: FileChooser.setMediaPath(“D:/intro- prog-java”); Always use forward slashes rather than backslashes Copyright © 2009 Curt Hill