Skip to content

Added downscaling to pdfToImage-Converter to avoid too big images - #41

Merged
LuisSchweinberger merged 2 commits into
robotik-challenge-mainfrom
hm-fixes
Apr 21, 2026
Merged

LuisSchweinberger merged 2 commits into
robotik-challenge-mainfrom
hm-fixes

Conversation

@LuisSchweinberger

@LuisSchweinberger LuisSchweinberger commented Apr 20, 2026 •

Copy link
Copy Markdown
Collaborator

This pull request introduces improvements to the PDF-to-image conversion utility and updates blueprint template setup. The most significant change is the enhancement of the convertPdfToImageClient function to automatically adjust image quality and scale to ensure the output file stays within a specified size limit. Additionally, a new blueprint template is added for hierarchical structures.

PDF-to-image conversion improvements:

  • Enhanced convertPdfToImageClient in pdfToImage.ts to automatically scale down and adjust image quality so the resulting image file does not exceed a specified maximum size (default 5MB). The function now tries multiple scales and JPEG qualities, falling back to the lowest quality if needed. The output file is always a JPEG. [1] [2] [3] [4]
  • Added a new helper function canvasToBlob for flexible conversion of canvas to a blob with specified MIME type and quality.

Blueprint template setup:

  • Added hierarchical-structures-template.json to the list of blueprint templates in setup-blueprints.js.

Copilot AI review requested due to automatic review settings April 20, 2026 10:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the client-side PDF-to-image conversion utility to avoid generating overly large thumbnail images by iteratively downscaling and lowering output quality, and extends the blueprint setup script to include an additional template.

Changes:

  • Add iterative scale/quality downscaling with a max output size threshold for convertPdfToImageClient.
  • Switch PDF conversion output to JPEG and introduce a reusable canvasToBlob helper.
  • Add hierarchical-structures-template.json to the blueprint setup list for VEC.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/lib/util/pdfToImage.ts Adds max-size-aware downscaling logic and changes output to JPEG with a helper for blob creation.
scripts/setup-blueprints.js Includes an additional template in the VEC blueprint generation list.

Comment thread src/lib/util/pdfToImage.ts Outdated
Comment thread src/lib/util/pdfToImage.ts Outdated
Comment thread src/lib/util/pdfToImage.ts Outdated
Comment thread src/lib/util/pdfToImage.ts Outdated
Comment thread src/lib/util/pdfToImage.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread src/lib/util/pdfToImage.ts
Comment thread src/lib/util/pdfToImage.test.tsx
@LuisSchweinberger
LuisSchweinberger merged commit e6b58bd into robotik-challenge-main Apr 21, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants