Class Notes (839,376)
Canada (511,314)
CSC108H1 (113)
Diane (4)
Lecture

Notes

8 Pages
129 Views

Department
Computer Science
Course Code
CSC108H1
Professor
Diane

This preview shows pages 1,2 and half of page 3. Sign up to view the full 8 pages of the document.
Description
Pictures and Pixels Thats what 1024 x 768 resolution means: 1024 pixels wide, 768 pixels high Pixel (0, 0) is upper left Pixel (1023, 0) is upper right Pixel (0, 767) is lower left Pixel (1023, 767) is lower right Colour Representation Colours: combinations of red, green, and blue Each component has intensity in range 0 - 255 Red: (255, 0, 0) Green: (0, 255, 0) Blue: (0, 0, 255) White: (255, 255, 255) Black: (0, 0, 0) >>> # Python also has functions, like in math. >>> max(5, 99, -2, 12) 99 >>> # This function asks the user to choose a file. >>> media.choose_file() >>> # I cant do anything with that file unless I remember it somewhere. >>> # Fortunately, Python has variables (kind of like in math). >>> x = 12 >>> y = 0 >>> z = 42 >>> max(x, y, z) 42 >>> # So I can use a variable to remember the filename the user chooses. >>> filename = media.choose_file() >>> # Python has remembered it. >>> filename uhu1dianehwomeninstructors.png >>> # Now I can ask Python to read the image stored in the file of that >>> # name, and load it into memory. >>> pic = media.load_picture(filename) >>> # And now I can ask it to show the picture on the screen. >>> media.show(pic) import media if __name__ == __main__: filename = media.choose_file() pic = media.load_picture(filename) media.show(pic) filename = media.choose_file() pic = media.load_picture(filename) media.show(pic) blue = media.get_blue(pixel) new_blue = int(blue * 0.7) media.set_blue (pixel, new_blue) #For sunset do the same to the green pixels. www.notesolution.com
More Less
Unlock Document

Only pages 1,2 and half of page 3 are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit