Menu

#236 Adding compression to generated PDFs?

5.X
closed
nobody
None
5.3.2.33921
Feature Request
Medium
TWAIN
2016-11-15
2016-11-14
Trejder
No

Hi there,

any chance we can get compression to PDFs created by NAPS2?

I have just scanned two page 300 DPI A4 document full of small images and PDF generated by NAPS2 was as high as 22.1 MB. When I put it through SmallPDF's Compress PDF on-line tool (https://smallpdf.com/compress-pdf) it managed to reduce generated file to as little as 240 kB without observable lost of quality.

That's nearly a HUNDRED times less!

Could this be, because NAPS2 is saving full page scanned images as BMP / otherwise uncompressed images while all Compress PDF do i to convert them back to JPGs?

Regards and thanks for feedback on this,
Trejder

Discussion

  • dronsf

    dronsf - 2016-11-15

    Probably the compression in NAPS2 is not optimized (I can easily manage to obtain smaller PDF files using Ghostscript), but the service you've mentioned degrades the quality quite noticeably. In fact it is stated on their site:
    "Reduce your scanned PDF files to 144dpi which is perfect for uploading files to the web and through email."
    I've made a test and both b/w and color images appear significantly degraded.

     
  • Trejder

    Trejder - 2016-11-15

    I wasn't aware of this notice, you have mentioned. Thanks, for bringing it up.

    Still, 22 MB PDF file for 2-pages document scan is way over my expectations, no matter what.

     
  • Ben Olden-Cooligan

    NAPS2 encodes images in PDFs as JPEG by default. You can configure this at the time of scanning by going to your profile settings, clicking Advanced, and changing the quality settings. "Maximum quality" encodes images as PNG instead of JPEG (which results in much larger files). You can also reduce the quality value which will reduce the size used by the JPEG compression.

     
  • Trejder

    Trejder - 2016-11-15

    When I scan the very same two pages as JPGs (in NAPS2) and save them as images, then both files will be 2-3 MB at most (if not lower).

    Thus, I still don't understand, why the very same two pages saved as PDF in NAPS2 ends up as 22 MB file?

    I can't quite imagine 300 DPI A4 (21 x 30 cm) single page JPG file having 10-11 MB. Looks more like bitmap, TIFF or very, very low / no compression image.

     
  • Ben Olden-Cooligan

    Can you upload a sample PDF that has this issue as an attachment here?

     

    Last edit: Ben Olden-Cooligan 2016-11-15
  • Trejder

    Trejder - 2016-11-15

    Ben, no need to upload sample files, case is solved now. Compression was disabled. After enabling it, generated PDFs are all OK (i.e. 700 kB instead of 17 MB etc.).

    However, there are two things that concerns me:

    1. I wasn't aware of "Advanced" button (and following dialog) in scan profile meaning, that I have never seen it before and thus I wasn't able to change anything in it. And yet, the "Maximum quality" checkbox was checked by default. Meaning that your sentence "NAPS2 encodes images in PDFs as JPEG by default" is incorret. At least for bare installation of NAPS2 5.3.2.33921.

    2. If -- as I understand it -- images encoding occurs when PDF file is saved, not when image is scanned, then why changing "Maximum quality" setting gives no effect on already scanned images? I saved two PDFs out of the same two-pages sample, one with "Maximum quality" enabled and second with disabled and both generated files were identically large. Should this work that way?

    Consider, if anything of above is a bug, that you should consider taking care of, or if these are features that are meant to work, like they work.

     
  • Ben Olden-Cooligan

    I'm glad it's solved for you. In terms of your points:

    1. From my testing it's correctly setting the defaults. I'm not sure why that happened for you. The only thing I know of that should change that is if you've edited the appsettings.xml file.

    2. The rationale for this is as follows:
      (a) If the current setting is used when you save, then you can have a situation where you try to increase the quality before saving, but a higher quality is not available because you scanned at the lower quality.
      (b) If scans are always done in maximum quality to prevent that and only compressed when you save, larger scans could end up taking gigabytes of space unnecessarily. Right now the quality you scan at is the quality you save at (for PDFs) which is most efficient.
      (c) That said, I could add two sets of options - one for scanning and one for saving - but that's not something I want to do right now.

     

    Last edit: Ben Olden-Cooligan 2016-11-15
  • Trejder

    Trejder - 2016-11-15

    Lots of thanks for all the explanations. Ticket may be closed. Thank you.

     
  • Ben Olden-Cooligan

    • status: open --> closed
     

Log in to post a comment.