print update, rewrite python in console

 

..

print(f'iter:{i}/{total}',sep='',end="\r",flush=True)

..


Thank you.

jupyter notebook, update 1 line printed string, python

 


refer to code.

...

from IPython.display import display

cnt=0
dh = display('Test2',display_id=True)
while True:
cnt += 1
dh.update(f'cnt:{cnt}') #print cnt and update
if cnt>100:
break

...


Thank you.

www.marearts.com

🙇🏻‍♂️

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.

🙇🏻‍♂️