В редакторе растровой графики GIMP есть опция получать изображение со сканера (через XSANE). Как в незабвенном Adobe Photoshop.[1] Сканируется некоторое количество страниц. 300 dpi
Потом стёркой (в GIMP) удаляются чёрные всякие полосы и глюки.
Потом сохраняется в формате tiff с LZW компрессией.
Раньше под вендой я обзывал файлы номерами страниц. Например 001-002.tif
Сейчас тоже так стал делать, но в более сокращённом виде. Например 2.tiff
После сканирования получается вагон тиффов. Тиффы под линем объединяются в пдф-ку с помощью двух команд
1) tiffcp
Эта команда создаёт из вагона тиффов один многострваничный тифф
2) tiff2pdf
создаёт из многостраничного тиффа пдф-ку
Всё бы хорошо, но первой команде нужно ручками задать список файлов для объединения. Когда файлов больше сотни - это гимор,
Результат команды
Код: Выделить всё
find какойто-то ключ *.tiff
Код: Выделить всё
tiffcp $(find какойто-то ключ *.tiff)
Тогда я написал shell-скрипт. Первый в своей жизни, надо сказать.[2]
Код: Выделить всё
#! /bin/sh
#
# SCRIPT: pdfftiff.sh
#
# AUTHOR: Cherep [at] www.chemport.ru forums
#
# DATE: 14-02-2009
#
# REV: 0.1.A
#
# PLATFORM: Linux (>2.6.18 ?)
#
# LICENSE: GPL
#
# REQUIREMENT: tiffcp and tiff2pdf to be installed
#
# PURPOSE: This script is used for creation of a single pdf file from many tiff files.
# In particular,
# author used it to combine many scanned book pages into a single book (as a pdf file).
#
# USAGE: While scanning, image files are named with some increment ($incf) (i.e. 2, 4, 6 for
# double-page images) and are collected in some directory.
# !!!! Note, .tiff extention should be used, not .tif (to be allowed later).
# (Actually need to check, if .tif would work).
# If one (or several) files are accidentely missing (i.e 8.tiff),
# the script will not stop running. It is possible
# to continue with the next file (like 10.tiff). Obviously, the pages will be missing
# in the pdf file. However,
# It is recommended to store the script in ~/bin/ (do not forget to edit $PATH (and chmod)).
# Just type pdfftiff.sh in the scanned images directory and answer a few easy questions.
# Alternatively, copy the script to the images directory and run ./pdfftiff.sh
#
#
#
# Initialize all variables
btifffname=
incf=
namepdf=
titlepdf=
stoppoint= # I would prefer this one to be boolean.
##################
# main
##################
until [ -e $namefile'.tiff' ]; #just checking if the filename is real
do
namefile=
echo -n "Enter first tiff file name (without extention): "
read namefile
done
echo -n "Enter page increment: "
read incf
echo -n "Enter pdf file name (without extention): "
read namepdf
echo -n "Enter pdf title: " #pdf document has a title that is different from the filename
read titlepdf
while [ -z "$stoppoint" ];
do
if [ -e $namefile'.tiff' ]; then #Reading all file names to create a string with a file list
btifffname=$btifffname' '$namefile'.tiff'
namefile=$[$namefile+$incf]
else
until [ "$stoppoint" = n -o "$stoppoint" = y ]; # To prevent entering crap
do
echo -n "File "$namefile".tiff does not exist. Is that the end of the book? (y/n): "
read stoppoint
done
if [ "$stoppoint" = n ]; then # In case numbering had been changed for some reason
until [ -e $namefile'.tiff' ];
do
namefile=
echo -n "Enter next tiff file name (without extention): "
read namefile
done
stoppoint=
fi
fi
done
#echo $btifffname
#uncomment the line above if you want to see the output with the file name list string
echo "Making one multipage tiff file..."
tiffcp -c lzw $btifffname temp.tiff
echo "Making the pdf file..."
tiff2pdf -z -t $titlepdf -o $namepdf'.pdf' temp.tiff
if [ -e $namepdf'.pdf' ]; then
echo "Your pdf file was successfully created! :D"
fi
echo "Removing temprorary multipage tiff file..."
rm temp.tiff
sleep 2 # waiting for two seconds

[2] Мне бы ещё книгу по языку shell. Хорошо? что в одной из книг по линю были глава про него.