ptrad
[redakcja.git] / src / sources / conversion.py
1 import subprocess
2
3
4 def resize_image(source_file, out_dir):
5     subprocess.run([
6         'convert',
7         source_file,
8         '-thumbnail', '1000x1000>',
9         out_dir + '/' + source_file.rsplit('/', 1)[-1]
10     ])
11     
12
13 def convert_image(source_file, out_dir):
14     subprocess.run([
15         'convert',
16         source_file,
17         '-resize', '1000x1000',
18         out_dir + '/' + source_file.rsplit('/', 1)[-1] + '.jpg'
19     ])
20
21
22 def convert_pdf(source_file, out_dir):
23     # TODO
24     pass
25
26
27 def convert_djvu(source_file, view_dir):
28     # TODO
29     pass