KevinHuSh commited on
Commit
023bf92
·
1 Parent(s): 574bc66

fix too large thumbnail issue (#817)

Browse files

### What problem does this PR solve?

#709

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. api/utils/file_utils.py +1 -1
api/utils/file_utils.py CHANGED
@@ -174,7 +174,7 @@ def thumbnail(filename, blob):
174
  if re.match(r".*\.pdf$", filename):
175
  pdf = pdfplumber.open(BytesIO(blob))
176
  buffered = BytesIO()
177
- pdf.pages[0].to_image().annotated.save(buffered, format="png")
178
  return "data:image/png;base64," + \
179
  base64.b64encode(buffered.getvalue()).decode("utf-8")
180
 
 
174
  if re.match(r".*\.pdf$", filename):
175
  pdf = pdfplumber.open(BytesIO(blob))
176
  buffered = BytesIO()
177
+ pdf.pages[0].to_image(resolution=32).annotated.save(buffered, format="png")
178
  return "data:image/png;base64," + \
179
  base64.b64encode(buffered.getvalue()).decode("utf-8")
180