Closed tangximing closed 2 years ago
@tangximing Please include a full repro, i.e. code and files so we can reproduce the issue.
We have the same issue. I just created a simple project which reproduce the issue.
The default encoding filter, FlateDecode is not very efficient for images. Please use DCT (JPEG) instead which produces much smaller files. The example https://github.com/unidoc/unipdf-examples/blob/master/image/pdf_add_image_to_page.go has been updated to do this.
@plar Did you get a chance to try this with a different image encoding filter?
DCT works fine. As a feature request it would be really nice if the library itself determines the type of encoding filter depending on the type of image.
@plar Good point. In most cases DCT probably fine for color images. If gray scale, then 8 bit DCT. If monochrome then JBIG2 etc. Will create a ticket for this, may need some research and experimentation to determine what gives best results. In the meantime explicitly setting DCT is a good practice. Will close this issue for now. Thanks.
Description
when converting image to pdf, the size increase too much
Expected Behavior
when converting image to pdf, the size is almost the same
Actual Behavior
when converting image in size 3m, the size of the pdf is almost 25m