blob: ac992af14f50291317eb504e1d82877c009f8161 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/sh
#
#############################################################################
#
# Shellscript to convert a set of JPEG files to a multipage PDF.
#
# Requirements: (1) Ghostscript needs to be installed on the local system.
# (2) ImageMagick needs to be installed on the local system.
#
# Usage: jpegs2pdf.sh output.pdf file1.jpeg [file2.jpeg [file2.jpeg [...]]]
#
# Copyright (c) 2007, <pipitas@gmail.com>
# Use, distribute and modify without any restrictions.
#
# Versions:
# v1.0.0, Jul 12 2007: initial version
# v1.0.1, Jan 07 2011: set viewJPEG.ps path (self-compiled GS 9.02)
#
#############################################################################
outfile=$1
shift
param=""
for i in "$@" ; do
dimension=$(identify -format "%[fx:(w)] %[fx:(h)]" "${i}")
param="${param} <</PageSize [${dimension}]>> setpagedevice (${i}) viewJPEG showpage"
done
gs \
-sDEVICE=pdfwrite \
-dPDFSETTINGS=/prepress \
-o "$outfile" \
viewjpeg.ps \
-c "${param}"
|