def resize_image(f):
    i = Image.open(f)
size_64 = 64, 64
fn, fext = os.path.splitext(f)
i.thumbnail(size_64)
out_path = 'resize/{}_64'.format(fn, fext)
i.save(out_path)
return out_path
s_jpg_files = s_jpg_list.map(resize_image)
print(('Converted Images:', s_jpg_files.collect()))
How do I properly transform a normal Python application into PySpark version