]> git.lyx.org Git - features.git/commitdiff
Add an option to crop to the left and to the right of the images if so desired. Add...
authorAngus Leeming <leeming@lyx.org>
Mon, 8 Jul 2002 11:57:30 +0000 (11:57 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 8 Jul 2002 11:57:30 +0000 (11:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4546 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/scripts/lyxpreview2ppm.sh

index 8cbde0b3f1ac0336be5fb0758bb03c753723a3ae..67a4e1bb695834ebf7cef0c6e588eca3f6868608 100644 (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>
        
index e6622432e875009046960edd841e82713bf58617..38c75186f3c5e5feb5b599bd84209cd0441510dd 100644 (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"`