01-11-2022, 10:19 PM | #1906 |
Fuzzball, the purple cat
Posts: 1,282
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
|
For future reference, these options impact the output images in the example from the previous post:
-g <gamma> (set gamma value, defaults to 0.5. Set to 1.0 for no change.) -cmax <val> (set max contrast adjust. Use 1.0 for no contrast adjustment.) -s (sharpen. Default is to sharpen. Use -s- to not sharpen.) -bpc <nn> (set bits per color. Default = 4.) |
02-07-2022, 05:58 PM | #1907 |
Groupie
Posts: 172
Karma: 248528
Join Date: Jan 2016
Device: none
|
Compressing a scanned PDF?
Hello,
I'd like to recompress an 800-page black and white PDF that is actually a scanned + OCRed copy of an out-of-print book. This is for viewing on the computer, not on an e-reader specifically. Without knowing what I'm doing, I simply tried the "-bpc" option on a single page, but it looks nowhere like the original, and it's the same size (~130kB → The whole book would be about 100MB, like the original). What switches would you suggest I try? Thank you. -- Edit: The following using Ghostscript only shrinks the page slightly (101,684 bytes → 85,876) : Code:
"c:\Program Files\gs\gs9.55.0\bin\gswin32c.exe" -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=single.output.pdf single.pdf Last edited by Shohreh; 02-08-2022 at 08:26 AM. |
Advert | |
|
02-10-2022, 06:48 PM | #1908 |
Fuzzball, the purple cat
Posts: 1,282
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
|
There are a number of options. Do you know what compression the existing PDF is using? If it’s already using JPEG 2000 (JPX), it’s unlikely you’ll be able to compress it down much further. You can use k2pdfopt with the -i option to see this (or from the GUI, the Help menu -> PDF File Info).
You want to start by using “-mode copy” as your conversion mode from k2pdfopt (from gui—it can be selected in the little “Conversion Mode” drop down—top right). Then there are various options to reduce the file size: -cmax <value> sets the max contrast. Getting the contrast up should make it so you can use fewer colors. -bpc <value> sets the number of bits per pixel. Default is 4. -jpg <quality> will store the page as jpeg images with adjustable quality. Otherwise the pages are stored essentially as .png which is lossless. -g <value> sets the gamma value and defaults to 0.5. This is done to darken the text. Set to 1 if you don’t want to change this. -odpi <value> will set the output dpi. Lowering this will reduce file size. Default=150. -c- will turn off color output (grayscale) which will save on size |
02-11-2022, 08:05 AM | #1909 |
Groupie
Posts: 172
Karma: 248528
Join Date: Jan 2016
Device: none
|
Here goes:
Code:
k2pdfopt.exe -i Single.page.source.pdf PDF VERSION: 1.3 PAGE SIZE: 5.81 x 9.18 in PAGES: 1 Page Ref Details Mediaboxes (1): 1 (3 0 R): [ 0 0 418 661 ] (5.81 x 9.18 in) Fonts (1): 1 (3 0 R): Type1 'Courier' (5 0 R) Images (2): 1 (3 0 R): [ Flate DCT ] 996x1575 8bpc DevRGB (6 0 R) 1 (3 0 R): [ JPX ] 872x1379 8bpc DevRGB (7 0 R) Code:
k2pdfopt.exe -mode copy -bpc 1 -c- Single.page.source.pdf Thanks! |
02-12-2022, 05:11 PM | #1910 |
Member
Posts: 17
Karma: 10
Join Date: Feb 2022
Device: Kindle paperwhite 3
|
Hi,
Thank you very much for this wonderful application, I have small problem, when I convert a file there is some variation in font, some lines are smaller than the rest of the book, I've tried two sets of additional options & the problem repeated: -as -vls 2 -bpc 1 -d- -r -odpi 300 -j 2 -fc- & -rt auto+ -d- -fc- -bpc 1 -vls -3 -vb 1.25 -ac 0.5 -ci 1 -er 1 -mag 1 With choosing following options: 1.Right- to-left text 2. Auto-crop 3.fast preview 4. Auto-straighten I've attached a screenshot of the problem, it's an Arabic book as you can see, thanks in advance. |
Advert | |
|
02-15-2022, 10:31 PM | #1911 |
Fuzzball, the purple cat
Posts: 1,282
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
|
Can you post the source PDF or a few pages from it? Or PM it to me? I think the issue is similar to the one from this post--e.g. you have rows of text where there is not a clean gap inbetween the rows. Options you can try adjusting are -gtr and -rsf.
Last edited by willus; 02-15-2022 at 10:53 PM. |
02-16-2022, 06:46 AM | #1912 | |
Member
Posts: 17
Karma: 10
Join Date: Feb 2022
Device: Kindle paperwhite 3
|
Quote:
This is the original book link: https://almobadarah.com/books/Baraheen.Allah.pdf It's a big file so I attached also a sample of it below. |
|
02-17-2022, 10:11 AM | #1913 | |
Member
Posts: 17
Karma: 10
Join Date: Feb 2022
Device: Kindle paperwhite 3
|
Quote:
So The additional commands was: -d- -fc- -vls -3 -vb 1.25 -ac 0.5 -ci 1 -er 1 -mag 1 -gtr 0.1 -rsf 18 The result was excellent, no variation of font at all as u can see in first screenshot, thank you very much. But there was a couple of things, sorry to bother you, I really want to learn, first some lines were broken at certain words,like in screenshot (2), I think this is related to the new options, if you can advice me of better values. Secondly, some footnotes were merged with the lines in next page as in screenshot (3) and (4), I tried option -bp- and -bp 0.5, to make break after the footnote, but it didn't work |
|
02-19-2022, 03:21 PM | #1914 |
Fuzzball, the purple cat
Posts: 1,282
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
|
I'm having two difficulties here--1. I don't have your source PDF, so I can't troubleshoot or try different things, and 2. I am not able to read Farsi, so that makes it difficult for me to even understand how the text should look. I don't know why the -bp option would not be working without having access to the source.
|
02-19-2022, 03:48 PM | #1915 | |
Member
Posts: 17
Karma: 10
Join Date: Feb 2022
Device: Kindle paperwhite 3
|
Quote:
|
|
02-19-2022, 05:36 PM | #1916 |
Member
Posts: 17
Karma: 10
Join Date: Feb 2022
Device: Kindle paperwhite 3
|
Here is a sample of the source pdf again if u want, and a screenshot of the footnote merged with next line (where the arrow points)
|
02-23-2022, 08:47 AM | #1917 |
Member
Posts: 17
Karma: 10
Join Date: Feb 2022
Device: Kindle paperwhite 3
|
After some trials i was able to get very good result wiyh some tweaks in the options, first i decreased gtr value to 0.09 instead of 0.1,
removed -mag & bp options, making-vls value 2 instead of -3, adding -bpc, so the additional commands was as follow : -er 1 -vb 1.25 -fc- -d- -ci 1 -gtr 0.09 -rsf 18 -vls 2 -bpc Now there is one final issue, when i transfered the file to my kindle i found that the page flipping order is from left to right, how can i change it to be from right to left as normal Arabic books. |
02-24-2022, 05:09 AM | #1918 |
Junior Member
Posts: 4
Karma: 10
Join Date: Dec 2014
Device: Boox M96
|
Using a new computer with the same OS, software versions and files as the previous: PopOS (Ubuntu) 21.10, k2pdfopt v2.53, Ghostscript 9.54.0.
On my old computer k2pdfopt works fine on two PDF's (101 and 116 pages, respectively). On my new computer k2pdfopt reads and converts only 6 pages of either document. The conversions of those 6 pages seem identical. Even though the version numbers are identical (k2pdfopt v2.53), the old computer reports 'Compiled Jul 18 2020 with Gnu C v8.2.1 for Linux on x64.' whereas the new computer reports 'Compiled Aug 26 2020 with Gnu C v10.2.0 for Linux on x64.' Options used in either case (Makefile): echo ""| k2pdfopt -c -fc- -dpi 150 -o $@.epub -x $@.pdf; Any suggestions? Last edited by pumpapa; 02-24-2022 at 05:11 AM. |
02-26-2022, 03:31 PM | #1919 | |
Fuzzball, the purple cat
Posts: 1,282
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
|
Quote:
k2pdfopt -p 100-1 ... (If your PDF has 100 pages, for example.) |
|
02-26-2022, 03:38 PM | #1920 | |
Fuzzball, the purple cat
Posts: 1,282
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
|
Quote:
|
|
Tags |
ebook apps, k5 tools, kindle tools, kindle touch, tools |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Viewing PDFs with another font | Font | PocketBook | 4 | 11-12-2010 08:27 AM |
Viewing Textbook PDFs... | NJReader | enTourage Archive | 4 | 08-17-2010 05:17 PM |
PRS-600 Restart bug while viewing PDFs? | conundrum | Sony Reader | 2 | 03-04-2010 08:46 PM |
More on viewing pdfs | dso371 | Bookeen | 8 | 03-11-2008 07:15 PM |
Viewing Untagged PDFs on Palm T|X | Eroica | Reading and Management | 3 | 12-10-2007 01:44 PM |