3/01/2022

check image is single color or not, python , PIL image

 refer to example code

..

#get image data
image = Image.open(xxx)
image = image.convert('RGB')

#skip if image has one color
colors = image.getcolors(image.size[0]*image.size[1])
imgH = image.size[1]
imgW = image.size[0]
#print(f'img object w:{imgW}, h:{imgH}')
if len(colors) == 1:
continue

..


www.marearts.com

Thank you.

๐Ÿ™‡๐Ÿป‍♂️

No comments:

Post a Comment