Skip to content

Commit

Permalink
v1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ashipunov committed Nov 8, 2010
1 parent 3f87115 commit f1329da
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions NEWS
@@ -1,3 +1,5 @@
1.11 Version number in default output; option for number of OCR jobs (thenks to Kyrill Detinov)

1.10 Bug fixes: bugs introduced in previous version :)

1.9 Bug fix: filenames with spaces (thanks to Kyrill Detinov)
Expand Down
4 changes: 2 additions & 2 deletions README
Expand Up @@ -58,9 +58,9 @@ Will use four-fold downsampling for color layers; result will be extremely compa

Will NOT use blur and contrast for processing color layers

> img2djvu -l 1 -r rus -e cuneiform -a 1 out
> img2djvu -l 1 -r rus -e cuneiform -j 2 -a 1 out

After creation of final DjVu, will run cuneiform with "-rus" language option via ocrodjvu and insert text layer in place
After creation of final DjVu, will run two OCR jobs of cuneiform with "-rus" language option via ocrodjvu and insert text layer in place

> img2djvu -c 1 out

Expand Down
2 changes: 1 addition & 1 deletion TODO
@@ -1,4 +1,4 @@
Make minidjvu accept filenames with spaces
Make minidjvu accept filenames with spaces, probablly sequentially rename files immediately after conversion

(?) MMR and JPEG (ald also 2k?) chunks (with djvumake) instead of JB2 and IW44 for B&W and color pages, respectively

Expand Down
12 changes: 8 additions & 4 deletions img2djvu
@@ -1,6 +1,5 @@
#!/bin/bash

### Version 1.10
### Inspired by script pdf-trim-to-djvu.sh (http://gist.github.com/315791)
### PUBLIC DOMAIN

Expand All @@ -16,6 +15,7 @@ ocrengine=""
ocrlanguage=""
verbmini=0
tmp=0
ocrjobs=1
# internal
prog="$0"
dpidefault="$DPI"
Expand All @@ -28,17 +28,20 @@ ocrenginedefault="$ocrengine"
ocrlanguagedefault="$ocrlanguage"
verbminidefault="$verbmini"
tmpdefault="$tmp"
ocrjobsdefault="$ocrjobs"

function usage() {
me=`basename "$prog"`
cat << END
img2djvu version 1.11
Usage: "$me" [options] relative_folder_name
Options:
-a <0|1|2> aggressivity: 0 is not aggressive, 1 is aggressive, 2 is very aggressive [default: "$agdefault"]
-c <0|1> make a choice of temporary directory, 0 for /tmp, 1 for current [default: "$tmpdefault"]
-d <int> resolution in DPI [default: "$dpidefault"]
-e "str" if not empty, use OCR engine (supported by ocrodjvu) with this name [default: "$ocrenginedefault"]
-j <int> number of OCR jobs [default: "$ocrjobsdefault"]
-l <int> if not 0, will use forced segmentation (with <int> downsampling) [default: "$codefault"]
-m <int> if not 0, will use minidjvu (with <int> dictionary size) instead of cjb2 [default: "$midefault"]
-r "str" if not empty, use OCR engine with given language [default: "$ocrlanguagedefault"]
Expand All @@ -50,14 +53,15 @@ Options:
END
}

opts=`getopt -l "help" "a:c:d:e:h:f:l:m:p:r:t:v:" "$@"` && eval set -- "$opts"
opts=`getopt -l "help" "a:c:d:e:h:f:j:l:m:p:r:t:v:" "$@"` && eval set -- "$opts"
while true ; do
case "$1" in
-h|--help) usage ; exit 0 ;;
-a) ag="$2" ; shift 2 ;;
-c) tmp="$2" ; shift 2 ;;
-d) DPI="$2" ; shift 2 ;;
-e) ocrengine="$2"; shift 2 ;;
-j) ocrjobs="$2"; shift 2 ;;
-l) usecodjvu="$2" ; shift 2 ;;
-m) usemini="$2" ; shift 2 ;;
-r) ocrlanguage="$2" ; shift 2 ;;
Expand Down Expand Up @@ -278,7 +282,7 @@ function nomini {
printf "\nDone.\n" && \
if [ "$useocr" -gt 0 ] ; then
printf "Starting OCR...\n"
ocrodjvu --engine "$ocrengine" --language "$ocrlanguage" --in-place --on-error=resume "$djvu"
ocrodjvu --engine "$ocrengine" --language "$ocrlanguage" --jobs "$ocrjobs" --in-place --on-error=resume "$djvu"
fi
) && rm -rf "$tmpdir" || (
printf "Failure\nTemporary directory left: %s\n" "$tmpdir"
Expand Down Expand Up @@ -342,7 +346,7 @@ function mini {
printf "\nDone.\n" && \
if [ "$useocr" -gt 0 ] ; then
printf "Starting OCR...\n"
ocrodjvu --engine "$ocrengine" --language "$ocrlanguage" --in-place --on-error=resume "$djvu"
ocrodjvu --engine "$ocrengine" --language "$ocrlanguage" --jobs "$ocrjobs" --in-place --on-error=resume "$djvu"
fi
) && rm -rf "$tmpdir" || (
printf "Failure\nTemporary directory left: %s\n" "$tmpdir"
Expand Down

0 comments on commit f1329da

Please sign in to comment.