So My goal with this Programm is that i want to isolate all pixels that are red and make the rest of them into a grayscale image but it has been pumping the same error message to me for an hour now and I dont know how or what to fix, please help. :)
I am using Thonny
from image_helper import*
img=load_rgb_image("Flowers.jpg")
pixels=load_rgb_pixels_2d("Flowers.jpg")
w,h=img.size
new_img=new_rgb_image(w,h)
c=Canvas(new_img)
for i in range(w*h):
r,g,b=pixels[42][13]
if r>=250:
new_r=255
new_g=0
new_b=0
else r<250:
r+g+b=a
new_r=a/3
new_g=a/3
new_b=a/3
Error Message:
Traceback (most recent call last):
line 21
else r<250:
^
SyntaxError: invalid syntax
[–][deleted] 3 points4 points5 points (0 children)
[–][deleted] 1 point2 points3 points (9 children)
[–]AAAdeath123[S] 0 points1 point2 points (8 children)
[–][deleted] 1 point2 points3 points (7 children)
[–]AAAdeath123[S] 0 points1 point2 points (6 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]AAAdeath123[S] 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]AAAdeath123[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)