![]() Notice that when you run it and select " caterpillarSmall.jpg" the following is output: > viewPicture() Print "A different way to get the pixel at 0, 0 is: ", pixels Print "The value of the pixel at 0, 0 is: ", pixel Print "width is", getWidth(pict), "height is", getHeight(pict) The following function is a compilation of all of the JES functions mentioned above. If you are not sure which functions are part of Python or which are part of JES, you can look in the JES menu under Help > Understanding Pictures. getPixel, which returns one Pixel object at x and y coordinates.getPixels, which returns a list of all the pixels (Pixel objects) in the picture.getWidth, which returns the number of pixels from left-to-right.getHeight, which returns the number of pixels from top-to-bottom.makePicture, which creates a picture object.pickAFile, which pops up a file choosing dialog and returns a string for the file chosen.You will find that some functions that we use for pictures are not part of Python they only work inside of JES. 1.1 JES Code for Viewing Pictures and Properties In the next sections, we will take a closer look at pictures using JES/Python, and then examine pixels and the RGB color model. In summary, pictures are made up of (really) tiny "boxes" of color. Have you every zoomed in so close to an image that you see individual boxes? One of those "boxes" represents a pixel (short for "picture element"). Pictures are two-dimensional arrays of pixels. In order to understand, how to manipulate pictures, you first need to understand how pictures are represented on a computer. Please get the code examples and image used in this lab, by clicking here JES Code for Viewing Pictures and Properties.CS325: Python for Image Manipulation Python for Image Manipulation
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |