Skip to content

fix(imagemagick): handle multi-page PDF outputs and improve rasterization quality - #593

Open
OrbanGergo wants to merge 2 commits into
C4illin:mainfrom
OrbanGergo:fix/imagemagick-multipage-output
Open

fix(imagemagick): handle multi-page PDF outputs and improve rasterization quality#593
OrbanGergo wants to merge 2 commits into
C4illin:mainfrom
OrbanGergo:fix/imagemagick-multipage-output

Conversation

@OrbanGergo

@OrbanGergo OrbanGergo commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Fix ImageMagick multi-page PDF conversions by storing the actual generated output filenames instead of assuming a single output file.

ImageMagick generates numbered output files for multi-page PDFs (e.g. filename-0.png, filename-1.png), but only filename.png was stored in the database. As a result, the View and Download actions attempted to access a file that did not exist.

Also increase PDF rasterization density to 300 DPI to improve PDF-to-image conversion quality.

Changes

  • Detect generated output files after conversion.
  • Store all generated output filenames in the file_names table.
  • Preserve existing behavior for single-output conversions.
  • Increase PDF rasterization density to 300 DPI for improved image quality.

Validation

  • Converted a 2-page PDF to PNG using ImageMagick.
  • Verified that all generated output files are stored in the file_names table.
  • Verified that View and Download work correctly for each generated output file.
  • Verified that PDF-to-PNG output quality is improved with 300 DPI.

Closes #541
Closes #340


Summary by cubic

Fix multi-page PDF conversions by saving all ImageMagick outputs and improve PDF-to-image quality with 300 DPI rasterization. This restores working View/Download links per page and produces sharper images.

  • Bug Fixes
    • Discover, filter, and numerically sort generated files (e.g., filename-0.png, filename-1.png) instead of assuming a single output.
    • Preserve single-file behavior when only one output is produced.
    • Add -density 300 for pdf input to improve rasterization quality.

Written for commit ad91743. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added Fix and removed Fix labels Jul 31, 2026
@OrbanGergo
OrbanGergo force-pushed the fix/imagemagick-multipage-output branch from 625cc9b to c7e451f Compare July 31, 2026 15:28
@github-actions github-actions Bot added Fix and removed Fix labels Jul 31, 2026
@OrbanGergo
OrbanGergo force-pushed the fix/imagemagick-multipage-output branch from c7e451f to 69ae4a9 Compare July 31, 2026 15:30
@github-actions github-actions Bot added Fix and removed Fix labels Jul 31, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/converters/main.ts Outdated
Comment thread src/converters/main.ts Outdated
@github-actions github-actions Bot added Fix and removed Fix labels Jul 31, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/converters/main.ts
@github-actions github-actions Bot added Fix and removed Fix labels Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Converting a 2 page PDF to PNG, creates 2 png files, but they cannot be downloaded Animated image conversion - Invalid link returned

1 participant