0

I am trying to achieve a program that breaks down every line of an image into its RGB Figure (this bit i have done) then assign this to a increasing variable that corresponds to its row number. I want to achieve the following result:

(input) line1
(output) (whatever the value is, in this form ([(255, 255, 255), (255, 255, 255)]) e.g.

so far i have done this:

from PIL import Image
import os
os.chdir("C:\\Users\\User\\Desktop\\CWD")
im = Image.open("bw.jpg")
data_RGB = im.convert("RGB")
actual = list(data_RGB.getdata())
size = im.size[0]
counter = 0

while counter != size:
    lowerbound = 0
    upperbound = size
    print (actual[(0+lowerbound):(0+upperbound)])
    print("")
    #current_line = (actual[(0+lowerbound):(0+upperbound)])
    print("")
    counter = counter + 1
    (lowerbound) = int(lowerbound) + size
    (upperbound) = int(upperbound) + size

I have tried to solve the problem down this route:

for x in list(range(size+1)):
print("line", x, "is", current_line)

but ofcource this prints what current_line is at a static point, the first point that it is.

So my question is, is there a way in which i can increase my variable name by +1 for the corresponding row.

Can anyone give me a start for a solution?

0 Answers0