In [15]:
import os
from PIL import Image

In [16]:
num = 3
img_path = '/home/pj/pro/android/inBack/src/components/login/images/loginButton.png'.format(num)
img = Image.open(img_path)

In [17]:
img.size


Out[17]:
(750, 1334)

In [22]:
out = img.crop((56, 980, 694, 1089))
with open('{}.png'.format(num), 'wb') as f:
    out.save(f)

In [14]:
# resize ==> 
import os
base_path = '/home/pj/pro/android/inBack/src/components/catalog/images/'
out_path = os.path.join(base_path, 're')
if not os.path.exists(out_path):
    os.mkdir(out_path)
path = '/home/pj/pro/android/inBack/src/components/catalog/images/{}.png'

for i in range(4):
    im_path = path.format(i + 2)
    im = Image.open(im_path)
    out = im.resize((330, 248))
    with open(os.path.join(out_path, '{}.png'.format(i + 2)), 'wb') as f:
        out.save(f)

In [ ]:
img_path_1 = '/home/pj/pro/android/inBack/src/components/register/images/accountInfo.png'
img_path_2 = ''
img = Image.open(img_path)