I have a 2d array that i got from and image, for now it has 0s and 255s, I want to change all the 255s into 1s, this is a very easy task for a for loop.
for i in range(lenX):
    for j in range(lenY):
        if img[i,j]==255:
            img[i,j] = 1
here img is my array. I am pretty sure that there is a simpler way to do it using some kind of numpy function or something. but I looked every where I couldn't find.
If you know how to do this easily.. please help me
 
     
    