Class Notes (807,845)
CSCA67H3 (56)
Lecture

# Notes

8 Pages
178 Views

School
University of Toronto Scarborough
Department
Computer Science
Course
CSCA67H3
Professor
Anna Bretscher
Semester
Winter

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

Related notes for CSCA67H3

OR

Don't have an account?

Join OneClass

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

Join to view

OR

By registering, I agree to the Terms and Privacy Policies
Just a few more details

So we can recommend you notes for your school.