import cv2 import numpy as np from PIL import Image n_file_name ='Downloads/sample.png' # n_file = cv2.imread(n_file_name) img = Image.open(n_file_name) orig_h,orig_w = img.size px = img.load() print(px[2,2][2]) #n_array = cv2.resize(n_array,(orig_w,orig_h)) h,w = orig_h,orig_w # print(orig_rgb) print(h) print(w) # alpha_channel = np.zeros([h,w]) num = 0 for y in range(0,h): for x in range(0,w): #print(px[y][x][3] ) if px[y,x][3] == 0: print(px[y,x]) num = num + 1 print(num)