21 lines
546 B
Python
21 lines
546 B
Python
import os
|
|
import shutil
|
|
import sys
|
|
|
|
|
|
def merge_images(input_folder, output_folder):
|
|
if not os.path.exists(output_folder):
|
|
os.mkdir(output_folder)
|
|
|
|
count = 0
|
|
for root, _, filenames in os.walk(input_folder):
|
|
for fn in filenames:
|
|
if fn.endswith('.jpg'):
|
|
count += 1
|
|
shutil.copy(os.path.join(root, fn), os.path.join(output_folder, 'c_{:010d}.jpg'.format(count)))
|
|
|
|
if __name__ == '__main__':
|
|
if (len(sys.argv) < 2):
|
|
sys.exit(1)
|
|
merge_images(sys.argv[1], 'output')
|