i want convert images to pixels
i do so
each row it is one picture
i do so
from PIL import Image im = Image.open('image.jpg') pixels = list(im.getdata()) result = [] counter = 0 for pixel in pixels: counter += 1 result.append(['pixel'+ str(counter), pixel[1]]) return (result) and get the result ['pixel1', 72], ['pixel2', 50], ['pixel3', 0], ['pixel4', 11], ['pixel5', 30], ['pixel6', 42], ['pixel7', 107], ['pixel8', 123] here one picture but there are many pictures, i want covert it all to pixels the path so i want take all picture from here im = Image.open('C:\Users\Admin\Downloads\mypicture)output in csv file?
each row it is one picture
Output: pixel1 pixel. pixel158 pixel159 pixel160 pixel161 pixel162 pixel163 pixel164 pixel165 pixel166 pixel167 pixel168 pixel169 pixel170 pixel171 pixel172
1 0 … 0 191 250 253 93 0 0 0 0 0 0 0 0 0 0
2 0 … 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0
pixel173 pixel174 pixel175 pixel176
1 0 0 0 0
2 0 0 16 179
how to do it correct?