get infinity input PIL (python)
<p>I'm writing a program that converts image to png and converts size to 512,
I want to get more input. </p>

<pre><code>from PIL import Image
import string
import random

put = input("enter your image path:")
im = Image.open(put)
size = (512,512)

if im.size &gt; size:
        im.thumbnail(size,Image.ANTIALIAS)    
else:
       print ("it's ready")

ranam = (''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(12)))
name = "d:/arjang/images/" + ranam

im.save(name + ".png")
</code></pre>

<p>Please help.</p>

<p>This will loop, asking for another image path to resize, until you enter an empty string:</p>

<pre><code>from PIL import Image
import string
import random

while True:

    put = input("enter your image path:")
    if not put.strip(): break
    im = Image.open(put)
    size = (512,512)
    if im.size &gt; size:

        im.thumbnail(size,Image.ANTIALIAS)

    else:
        print ("it's ready")

    ranam = (''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(12)))
    name = "d:/arjang/images/" + ranam

    im.save(name + ".png")
</code></pre>

python input python-imaging-library pillow