Daniel Reetz, the founder of the DIY Book Scanner community, has recently started making videos of prototyping and shop tips. If you are tinkering with a book scanner (or any other project) in your home shop, these tips will come in handy. https://www.youtube.com/channel/UCn0gq8 ... g_8K1nfInQ

GMIC, great discovery

General discussion about software packages and releases, new software you've found, and threads by programmers and script writers.
User avatar
dingodog
Posts: 108
Joined: 22 Jul 2010, 18:19
Number of books owned: 1000
Country: on the net
Location: on the net
Contact:

Re: GMIC, great discovery

Post by dingodog » 30 Apr 2015, 18:56

geaplanet wrote:I convert to pdf with pdfbeads, it chooses the best compressor for pages depending on their content.
Ah, right, I use more heavily jbig2enc since my books have no images or very few inside

the patch adds

1 - the P switch to jbig2enc

Code: Select all

-P <number> --pages-per-dict <number>: pages per dictionary (default 15)
very useful to make pdf consisting in many scanned pages (thousand of pages) that are not too heavy to load since number of pages for dictionary, when jbig2enc performs the symbols discrimination can be settled to a limited amount

2 - as stated by Alexey Kryukov here
I propose a patch which changes jbig2 behavior at two aspects. First, the files generated in the "-p" mode now retain their original names, and just the extension is changed (I use ".jbig2", but whatever else would be OK). A numerical suffix is added in case of name clashes (or for images which go from multipage tiff files). For this reason the 'basename' parameter is gone. The reason for this change is that source images may have some accompanying files (such as background images previously separated with a scan processing application). In such case file names contain some useful information which should not be lost during the processing/conversion.

The second change allows to generate more than just one symbol dictionary, so that the loading speed for large PDF files can be increased. There is now a new option (-P, --pages-per-dict), which specifies how many pages should be processed at the same pass. The default value for this parameter is 15.

I also propose a modified version of pdf.py, implementing support for background images, which can be combined with the foreground mask in the same pdf file. Several graphical formats (PNG, TIFF, JPEG) are supported. It is possible either to use graphics stripped by jbig2 at the previous stage, or prepage images separately in a different application, given that the file names follow the same convention.
the second task (combining images with the foreground mask in the same file needs the PIL image library)

I have the patch in another drive

User avatar
dingodog
Posts: 108
Joined: 22 Jul 2010, 18:19
Number of books owned: 1000
Country: on the net
Location: on the net
Contact:

Re: GMIC, great discovery

Post by dingodog » 02 May 2015, 16:07

I tried your cde package of gmic

in an old kernel (2.6.21.7) it returns a FATAL ERROR KERNEL TOOL OLD

trying a more recent kernel (3.4.82 ) it works at invocation

trying the specific command line you posted however:

Code: Select all

gmic *.jpg -iain_iains_nr 3,3,1,0,0,0,1,0,0,0,1.35,0,0 -o img.jpg
returns this:

Code: Select all

./gmic.cde  *.jpg -iain iains_nr 3,3,1,0,0,0,1,0,0,0,1.35,0,0 -o img.jpg

[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input file '1.jpg' at position [0] (1 image 1440x900x1x3).
[gmic]-1./ Input file '-iain' at position [1]
[gmic]-1./ *** Error *** Unknown command or filename '-iain' (did you mean '-asin' ?).
[gmic] *** Error in ./ *** Unknown command or filename '-iain' (did you mean '-asin' ?).
thanks anyway for patience, maybe I'll give a look to minino live cd

geaplanet
Posts: 24
Joined: 20 Jan 2015, 04:17
Number of books owned: 0
Country: spain

Re: GMIC, great discovery

Post by geaplanet » 03 May 2015, 15:24

Cool! It sounds good :-)
Now you only have to update gmic definitions commands with:

gmic -update

And later try again with the command you run yesterday.

User avatar
dingodog
Posts: 108
Joined: 22 Jul 2010, 18:19
Number of books owned: 1000
Country: on the net
Location: on the net
Contact:

Re: GMIC, great discovery

Post by dingodog » 04 May 2015, 17:00

thanks for tip

I tried as suggested and this was the output

Code: Select all

./gmic.cde -update
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Update commands from the latest definition file on the G'MIC server.sh: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
sh: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
So I copied libncurses.so.5 from /usr/lib/libncurses.so.5 to cde-package lib

Code: Select all

# cp /usr/lib/libncurses.so.5   /root/cde-package/cde-root/lib/i386-linux-gnu/
dir and tried again, this time the output was

Code: Select all

# ./gmic.cde -update
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Update commands from the latest definition file on the G'MIC server.
[gmic] *** Error in ./update/_update/*local/ *** Command '-update' : Unreachable update file.
something wrong with portabilization (cde is wonderful but not perfect, everybody knows)

but fortunately I found that on sourceforge there are static packages of gmic

http://sourceforge.net/projects/gmic/files/linux/

I downloaded this
gmic_static_1.6.3.0_pre_linux32.zip

that is NOT a FULLY STATIC package (more properly it is a so-called PSEUDO-STATIC since has external dependencies from GLIBC_2.7 and GLIBC_2.11

Code: Select all

./gmic: /lib/libc.so.6: version `GLIBC_2.7' not found (required by ./gmic)
./gmic: /lib/libc.so.6: version `GLIBC_2.11' not found (required by ./gmic)
)

and cannot work in systems with glibc 2.5, however I bypassed this issue running this pseudo.static package in a system with newer glibc and then packed dependencies with magicermine (I own an Ermine pro license)

so, the executable was working without pains in my system based on glibc 2.5

i typed

Code: Select all

./gmic -update
an hidden file (1500 KB about) named

Code: Select all

.cli_update1630.gmic
(attached bzipped)

was created and filled from web location of gmic servers in /root

and this time the command

Code: Select all

./gmic *.jpg -iain_iains_nr 3,3,1,0,0,0,1,0,0,0,1.35,0,0 -o img.jpg
was successfully executed

many thanks again. Since I run gmic in command line mode, do you know the command line for the repair scanned documents feature?

I hope my discoveries will be useful also to other forum members, thanks to geaplanet for suggesting gmic!
Attachments
.cli_update1630.gmic.bz2
(314.47 KiB) Downloaded 166 times

geaplanet
Posts: 24
Joined: 20 Jan 2015, 04:17
Number of books owned: 0
Country: spain

Re: GMIC, great discovery

Post by geaplanet » 05 May 2015, 14:58

I recommend you use GIMP plugin to adjust the settings according to your needs with one page. Using the sliders you can adjust the result to the characteristics of the paper and the light of your scans. Then set output mode to the name of the layer (for example), and that will be the line you have to use in gmic command for use with all other pages in your work.

Here you more information: http://sourceforge.net/p/gmic/wiki/The% ... 20plug-in/

Post Reply