Automattic / Automattic/node-canvas

Can the size of the image when converting to PDF be reduced

Open
#2,531 0 comments 0 reactions 0 assignees View on GitHub
Feature
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

As far as I know

For jpeg images, You can set img.dataMode = Image.MODE_MIME or Image.MODE_MIME/Image.MODE_IMAGE enables MIME data tracking of images.When MIME data is tracked, PDF canvases can embed JPEGs directly into the output, rather than re-encoding into PNG. This can drastically reduce filesize and speed up rendering.

For png images, I couldn't find any configurations that can optimize file size, and I analyzed that after embedding png images into PDFS, they should be compressed to FlateDecode

Can png be embedded in PDF using the DCTDecode compression method?

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named. Start by reproducing PDF output from JPEG and PNG images, then trace node-canvas's PDF image-embedding path and compare the resulting compression filters and file sizes. Done means the PNG behavior and any supported configuration are validated with a focused regression test or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.