Added progress meter

This commit is contained in:
Sayantan Santra 2023-04-17 11:04:20 -05:00
parent 36e317b3d5
commit 5b5f9951ed
1 changed files with 3 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import sys
import os import os
from pdf2image import convert_from_path from pdf2image import convert_from_path
from PIL import Image from PIL import Image
from tqdm import tqdm
if len(sys.argv) < 3: if len(sys.argv) < 3:
raise Exception( raise Exception(
@ -48,9 +49,8 @@ else:
pagenum = len(pdf) pagenum = len(pdf)
new_pdf = list() new_pdf = list()
for i in range(pagenum): for i in tqdm(range(pagenum)):
page = Image.new('L', new_size, 'white') # The '1' means black and white page = Image.new('L', new_size, 'white')
old_size = pdf[i].size old_size = pdf[i].size
ratio = min(new_size[0]/old_size[0], new_size[1]/old_size[1]) ratio = min(new_size[0]/old_size[0], new_size[1]/old_size[1])
resize_to = round(old_size[0]*ratio), round(old_size[1]*ratio) resize_to = round(old_size[0]*ratio), round(old_size[1]*ratio)