Commit 59af6bb9 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

added batch converting

parent 25ce6e0e
#!/usr/bin/env python3
from jp4_composite import JP4_C
#import cv2
import numpy as np
import sys
from PIL import Image, ImageOps
import os
try:
src = sys.argv[1]
except IndexError:
src = "."
try:
dst = sys.argv[2]
except IndexError:
dst = "."
lst = os.listdir(src)
lst.sort()
for f in lst:
path = os.path.join(src,f)
if os.path.isfile(path):
print("Converting "+f)
img = JP4_C(path)
#print(img.exif.toString())
#print(img.exif.data['Model'])
img.deblock()
img.demosaic_bilinear()
img_arr = img.saturation()
im = Image.fromarray(img_arr.astype(np.uint8))
im.save(os.path.join(dst,img.basename+"_"+str(img.subnames)+".jpeg"))
#subs = img.extract_subframes()
#for i in range(len(subs)):
#subs[i].save(os.path.join("../res",img.basename+"_"+str(img.subnames[i])+".png"))
# subs[i].save(os.path.join(dst,img.basename+"_"+str(img.subnames[i])+".jpeg"))
......@@ -54,6 +54,10 @@ class JP4_C(JP4):
else:
subnames = [chn-101,chn-101+8,chn-101+16]
else:
subnames = self.exif.data['Page'][0]
return subnames
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment