Working state.
This commit is contained in:
@@ -87,7 +87,6 @@ def process_label(root_dir, student_id, label, content):
|
||||
|
||||
if not os.path.exists(pdf_path):
|
||||
return None, []
|
||||
|
||||
base_img, total_h, max_w = annotating.make_base_image(pdf_path)
|
||||
if not base_img:
|
||||
return None, []
|
||||
@@ -239,12 +238,14 @@ def process_student(args):
|
||||
# Au moins, le drift n'empire pas au fil de la copie
|
||||
temp_img_path = os.path.join(output_dir, "Reference.jpg") # Can't use png here
|
||||
concat_img.save(temp_img_path, quality=90)
|
||||
|
||||
pdf_path = os.path.join(output_dir, "Concat.pdf")
|
||||
w, h = concat_img.size
|
||||
c = canvas.Canvas(pdf_path, pagesize=(w, h))
|
||||
c.drawImage(temp_img_path, 0, 0, width=w, height=h)
|
||||
c.save()
|
||||
|
||||
print("Debug : size", w, h)
|
||||
# Ancien code, avec du drift
|
||||
# concat_img.save(os.path.join(output_dir, "Concat.pdf"), "PDF", resolution=DPI)
|
||||
# concat_img.save(os.path.join(output_dir, "Reference.png"))
|
||||
@@ -268,4 +269,10 @@ if __name__ == "__main__":
|
||||
# print(tasks)
|
||||
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
|
||||
executor.map(process_student, tasks)
|
||||
results = executor.map(process_student, tasks)
|
||||
try:
|
||||
for _ in results:
|
||||
pass
|
||||
except Exception:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
Reference in New Issue
Block a user