[Libreoffice-commits] dev-tools.git: scripts/remove-thumbnail.sh
Varun Dhall
varun.dhall at studentpartner.com
Mon Jun 1 15:14:07 PDT 2015
scripts/remove-thumbnail.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
New commits:
commit 22f2d254ea045d8cd0503c91236ad9bb8365afb9
Author: Varun Dhall <varun.dhall at studentpartner.com>
Date: Tue Jun 2 00:09:40 2015 +0200
add script to remove thumbnail image from ODF files
Change-Id: Iec23d361e36aa1ec3a5950d74de9f3d874e83b9b
diff --git a/scripts/remove-thumbnail.sh b/scripts/remove-thumbnail.sh
new file mode 100644
index 0000000..c1641df
--- /dev/null
+++ b/scripts/remove-thumbnail.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# To Remove Thumbnail with its respective file entry in manifest.xml from LibreOffice Test Documents to conserve space
+# Usage: "./optimize.sh" "file_name.odt" Add relevant addresses if files are not in current working directory
+# Caution: Please make a copy of original file for backup. This script directly alters the original file
+# After running this script observe the change in size
+set -e
+cmdfolder=$(realpath "$1")
+echo $cmdfolder
+zip -d "$cmdfolder" "Thumbnails/*"
+TMPDIR=$(mktemp -d)
+unzip -j "$cmdfolder" "META-INF/manifest.xml" -d "$TMPDIR/META-INF/"
+cd "$TMPDIR/META-INF/"
+mv manifest.xml temp.xml
+grep -v "thumbnail" temp.xml > manifest.xml
+rm temp.xml
+cd ..
+zip -u "$cmdfolder" "META-INF/manifest.xml"
+rm -rf "$TMPDIR"
More information about the Libreoffice-commits
mailing list