Skip to content

request: Support compression for RGBA images #3933

@eirikur-nc

Description

@eirikur-nc

Hi there and thanks to the developers who've worked on this library, much appreciated.

I'm generating PDFs from a React app via react-to-pdf (which in turn uses jsPDF).
So far I've been converting canvas elements to jpeg images but I'd like to switch to lossless images. I can do that with PNGs and by enabling compression, but I've noticed that this more than doubles the PDF generation time. Looking at png_support.js, I can see that there's quite a lot of processing involved for PNGs. However, RGBA images are pretty much pass-through. The only work being done in rgba_support.js is the separation of the alpha channel from the color channels, so it's much faster but the resulting PDFs are huge because there's no compression support. My grasp of the PDF file format is very limited, but from what I gather, it should be possible to compress the RGBA images using Flate, hence this feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions