# Week 4 ## What if we sum over everything? ### Brightness Is defined to be greater than 153. - [ ] Variable - [x] Constant ```python MAX_BRIGHTNESS=153 ``` ```python main(): max_brightness=153 ``` ### What do we want to do? [narok] - [x] WORK WITH PIXELS - [x] Calculate pixel average - [x] If Bright <- Recognize - [x] Then Grayscale - [x] If not Bright <- Recognize - [x] Then Nothing ### About SimpleImage - Is a collection of Pixel objects - Are located by giving x,y pairs For loop over all pairs of x, then y\ #### Nested For loop ```python for x in range(0,image.width): for y in range(0,image.height): print(image.get_pixel(x,y)) ``` #### For each ```python for ix in image: print(ix) ``` ### Differences *For our problem as stated above* - For each iterates over a **collection** of objects - For iterates over a **range of values** SimpleImage is a collection of pixel objects SimpleImage can return pixel **values** with `get_pixel`, given `x` and `y` ## What is our next issue? [trim-crop] - [x] Pixels - [ ] For each - [x] For - [ ] Trimming - [ ] New Image - Old image -> 200,100 -> remove 30 - `image.width`-30 ### Steps - Adress the pixels to be removed - [x] New image - [ ] New height - [ ] New width ## What is our last issue? [add-border] - [x] Pixels - [ ] Padding - [ ] New Image