[GRASS-SVN] r68045 - grass-addons/tools
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Mar 12 09:00:12 PST 2016
Author: martinl
Date: 2016-03-12 09:00:12 -0800 (Sat, 12 Mar 2016)
New Revision: 68045
Added:
grass-addons/tools/svn-image.sh
Log:
add script to optimize images uploaded to SVN, see https://trac.osgeo.org/grass/wiki/Submitting/Docs#Images
Added: grass-addons/tools/svn-image.sh
===================================================================
--- grass-addons/tools/svn-image.sh (rev 0)
+++ grass-addons/tools/svn-image.sh 2016-03-12 17:00:12 UTC (rev 68045)
@@ -0,0 +1,37 @@
+#!/bin/sh
+set -e
+
+#
+# Usage:
+#
+# svn-image.sh image.png
+#
+# See: https://trac.osgeo.org/grass/wiki/Submitting/Docs#Images
+#
+# Author: Martin Landa <landa.martin gmail.com>
+#
+
+if test -z "$1" ; then
+ echo "$0 file.png"
+ exit 1
+fi
+
+filename=$1
+ext="${filename##*.}"
+if [ "$ext" != "png" ] ; then
+ echo "Only PNG files are supported"
+ exit 1
+fi
+basename=${filename%%.png}
+
+# optionally, but usually worth it (careful color quantization):
+pngnq -n 128 -s 3 $filename
+
+# shuffle original and quantitized image names
+mv $filename ${basename}_ORIG.png
+mv ${basename}-nq8.png $filename
+
+# compress better (lossless)
+optipng -o5 ${filename}
+
+exit 0
Property changes on: grass-addons/tools/svn-image.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ text/x-sh
Added: svn:eol-style
+ native
More information about the grass-commit
mailing list