ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Gleb Kulikov <gleb@asd.iao.ru>
To: community@altlinux.ru
Subject: Re: [Comm] Many images -> one pdf
Date: Mon, 28 Jun 2004 21:59:24 +0700
Message-ID: <200406282159.24885.gleb@asd.iao.ru> (raw)
In-Reply-To: <40DFCD6A.1060605@rambler.ru>

[-- Attachment #1: Type: text/plain, Size: 900 bytes --]

В сообщении от Понедельник 28 Июнь 2004 14:48 Yury Aliaev написал:

> Не подскажите ли мне, как можно осуществить следующую задачку: имеется
> отсканированная книга в виде кучи пронумерованных картинок, хочется ради
> удобства запихнуть всё это в один pdf или PostScript. Желательно --
> скриптом и автоматически, ибо прописывать более 150 файлов вручную

Всего-то 150...
Имхо, такие вещи лучше зажимать не в pdf, а в дежавю. Сначала convert в pnm, 
буде изначальные картинки были в другом формате, ну а потом cjb2.

Например, я пользуюсь для этой цели на скорую руку безоразно намалёваным 
скриптом (файл. начинающийся с бувквы C, считается цветным, и обрабатывается 
соответственно). Если отдельные странички были в pdf, их можно извлечь через 
gs:
gs -q -dNOPAUSE -dBATCH -r300 -sDEVICE=pbmraw -sOutputFile=name




-- 
						Салют, /GLeb

UIN: 15341920
jabber://gleb@asd.iao.ru
netmail: 2:5005/78

[-- Attachment #2: tdj.py --]
[-- Type: text/x-python, Size: 1876 bytes --]

#!/usr/bin/python

# где лежат файлы ppm (каталог оригинала)
originaldir = "./"

# где создавать временные .djvu
djdir = "./DJ/"
# ----------------------------------------------------------------------------------------------------------------
assemblelist = []
# ----------------------------------------------------------------------------------------------------------------
import os, os.path

def GetList(fromwhere):
	list =  os.listdir(fromwhere)
	result = []
	for item in list:
		if os.access(item, os.R_OK) and not os.path.isdir(item):
			if item.find(".pnm") > -1:
				result.append(item)
	return result

# ----------------------------------------------------------------------------------------------------------------
def CompressIt(fileslist):
	global djdir
	global assemblelist
	for file in fileslist:
		outname = file.replace(".pnm", ".djvu")
		if file.find("C")>-1:
			# outname = outname.replace("C", "")
			cmd = "c44  "
			# используем цветной кодировщик
			pass
		else:
			# иначе битональный кодировщик
			cmd = "cjb2  -clean -loose  "
			pass
		cmd = cmd + file + "  " + djdir+outname
		assemblelist.append(djdir+outname)
		if os.access(djdir+outname, os.R_OK):
			pass
		else:
			print cmd
			os.system(cmd)
# ----------------------------------------------------------------------------------------------------------------
# собираем воедино
def Assemble(files):
	cmd = "djvm -c outfile.djvu "
	files.sort()
	for item in files:
		cmd = cmd + item + " "
	print  cmd
	os.system(cmd)
# ----------------------------------------------------------------------------------------------------------------
def main():
	filesto =GetList(originaldir)
	CompressIt(filesto)
	global assemblelist
	Assemble(assemblelist)
# ----------------------------------------------------------------------------------------------------------------

if __name__ == "__main__":
	main()

  parent reply	other threads:[~2004-06-28 14:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-28  7:48 Yury Aliaev
2004-06-28  8:28 ` Vitaly Lipatov
2004-06-28 12:30   ` Yury Aliaev
2004-06-28 14:59 ` Gleb Kulikov [this message]
2004-06-28 15:52   ` Yury Aliaev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200406282159.24885.gleb@asd.iao.ru \
    --to=gleb@asd.iao.ru \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git