Add an option to crop to the left and to the right of the images if so desired. Add some blurb to the top of the script.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4546 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-07-08 11:57:30 +00:00
parent 96e974be46
commit 0cf115854c
2 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2002-07-08 Angus Leeming <leeming@lyx.org>
* scripts/lyxpreview2ppm.sh: added blurb. Crop the images to the
left and right if so desired.
2002-07-08 André Pönitz <poenitz@gmx.net>

View File

@ -1,4 +1,14 @@
#!/bin/sh
#
# \file lyxpreview2ppm.sh
# Copyright 2002 the LyX Team
# Read the file COPYING
#
# \author Angus Leeming, leeming@lyx.org
#
# with much help from David Kastrup, david.kastrup@t-online.de.
# The sed script was created with advice from Praveen D V <praveend@sasken.com>
# and the sed users' list sed-users@yahoogroups.com.
# This script takes a LaTeX file and generates PPM files, one per page.
# The idea is to use it with preview.sty to create small bitmap previews of
@ -105,6 +115,30 @@ STATUS=$?
rm -f ${SEDSCRIPT}
EXECUTABLE="extracting metrics"; CHECK_STATUS
# The ppm files have spurious (?! say some !) white space on the left and right
# sides. If you don't want this set REMOVE_WS=0.
REMOVE_WS=1
which pnmcrop > /dev/null
STATUS=$?
if [ ${STATUS} -ne 0 ]; then
REMOVE_WS=0
fi
if [ REMOVE_WS -eq 1 ]; then
TMP=.${BASE}.ppm
for FILE=`ls ${BASE}???.ppm`
do
pnmcrop -left -right ${FILE} > ${TMP}
STATUS=$?
if [ ${STATUS} -eq 0 ]; then
mv -f ${TMP} ${FILE}
fi
done
rm -f ${TMP}
fi
# All was successful, so remove everything except the ppm files and the
# metrics file.
FILES=`ls ${BASE}* | sed -e "/${BASE}.metrics/d" -e "/${BASE}.*.ppm/d"`