In [2]:
import os
import numpy as np
import subprocess as sp
convert -delay 2 -loop 0 *.png animated.gif composite -dissolve 60 -gravity South summary_X1517240_anat.jpg summary_X1517240_func.jpg -alpha Set test.jpg
In [3]:
in_path = '/data1/auto_qc/sample_data/adhd200_qc_niak/test'
test_path = '/data1/auto_qc/sample_data/adhd200_qc_niak/new_test2'
if not os.path.isdir(test_path):
os.makedirs(test_path)
anat = 'summary_X1517240_anat.jpg'
func = 'summary_X1517240_func.jpg'
In [44]:
dis = np.arange(0,101,20)
dis = np.array([0,50,100])
In [45]:
anat_path = os.path.join(in_path, anat)
func_path = os.path.join(in_path, func)
file_list = list()
for idx, dissolve in enumerate(dis):
out_path = os.path.join(test_path, '{}_out_{}.jpg'.format(idx, dissolve))
file_list.append(out_path)
command = ['composite', '-dissolve', '{}'.format(dissolve), '-gravity', 'South',
anat_path, func_path, '-alpha', 'Set', out_path]
print(sp.call(command))
In [50]:
command2 = ['convert', '-delay', '20', '-loop', '1'] + file_list + file_list[::-1] + [os.path.join(test_path,'animated_lowres.gif')]
In [51]:
sp.call(command2)
Out[51]:
In [41]:
dis
Out[41]:
In [ ]: