0% found this document useful (0 votes)
14 views

PythonBasic Assignment14

Uploaded by

nikhilesh singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
14 views

PythonBasic Assignment14

Uploaded by

nikhilesh singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
6110123, 9:34 PI In [19] In [2]: In (23): Unitles-Jupyter Notebook Assignment 14 1. What does RGBA stand for? RGBA\s a four-channel format containing data for Red, Green, Blue, and an Alpha value. Where Alpha Represents the Opacity 2. From the Pillow module, how do you get the RGBA value of any images? ImageColor getcolor() gives roba value of any image 3. What is a box tuple, and how does it work? box tuple is tuple value of four integers: the left-edge x-coordinate, the top-edge y-coordinate,the width, and the height, respectively. 4. Use your image and load in notebook then, How can you find out the width and height of an Image object? example Program from PIL import Tnage pic = Image-open( ‘desk top-wal lpaper-1920x1080- joker-best -friends-1aptop-full-backgrounds-and. jpi print(f"width, Height -> {pic.size)') # Approach 1 print(F'width, Height -> {pic.width}, {pic.height}") # Approach 2 width, height + pic.size print(f"Width, Height -> {width}, {height)') # Approach 3 Width, Height => (850, 478) Width, Height -> 850,478 Width, Height -> 850,478 5. What method would you call to get Image object for a 100x100 image, excluding the lower-left quarter of it? rom PIL import Inage img = Image. open( 'desktop-wal lpaper-1920x1080-joker-best -friends- laptop- full -backgrounds-and. jpt new_ing = ing.crop((0,50,50,50)) 6. After making changes to an Image object, how could you save it as an image file? ‘#Example Program from PIL import Tnage pic = Image-open( ‘desk top-wal lpaper-1920x1080- joker-best -friends-laptop-full-backgrounds-and. jpi Pic.save(‘pic. jpg") localhost 8888/notebooks/Documents/Untied ipynb?kernel_name=python’ 42 6110123, 9:34 PI Unitles -Jupyter Notebook 7. What module contains Pillow's shape-drawing code? Pillows ImageDraw module contains Shape drawing methods 8. Image objects do not have drawing methods. What kind of object does? How do you get this kind of object? ImageDraw objects have shape-drawing methods such as point(),line(), or rectangle().They are returned by passing the Image object to the ImageDraw Draw) function, locahos 8888/notebooks/Documents/Untied ipynb Kern 22

You might also like