FunctionRacerProblemsRace

Brighten Image

EasyNumPyPython

img is a 2-D array of pixel brightness values from 0 to 255. Add amount to every pixel (it can be negative), but never let a pixel go below 0 or above 255. Return the new array.

Example 1

img [[10,200],[250,128]]
amount 20
returns [[30,220],[255,148]]

250 + 20 would be 270, so it stays at 255.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems