This repository has been archived by the owner on May 7, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Markus Reiter <me@reitermark.us>
- Loading branch information
1 parent
14ca109
commit 8b59935
Showing
1 changed file
with
10 additions
and
30 deletions.
There are no files selected for viewing
40 changes: 10 additions & 30 deletions
40
extensions/ui/iconset/org.eclipse.smarthome.ui.iconset.classic/icons/_iconconvert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,20 @@ | ||
#!/bin/sh | ||
#!/usr/bin/env bash | ||
|
||
for file in "${1}"*.svg; do | ||
set -e | ||
|
||
for file in "${1}"*.svg; do | ||
if [[ "${file}" != 'none'* ]]; then | ||
png="${file%.svg}.png" | ||
|
||
png=`echo "${file}" | sed s/.svg/.png/` | ||
# Clean up SVG file. | ||
svgcleaner --indent=2 "${file}" "${file}" | ||
|
||
# format SVG file | ||
if type xmllint &>/dev/null; then | ||
xmllint "${file}" -o "${file}" --pretty 1 | ||
else | ||
echo "error: xmllint not installed" 2>1 | ||
exit 1 | ||
fi | ||
|
||
# convert SVG file to PNG | ||
# Convert SVG file to PNG. | ||
if [ ! -f "${png}" ]; then | ||
|
||
if type rsvg-convert &>/dev/null; then | ||
|
||
# dependency: librsvg | ||
echo "rsvg-convert: converting ${file}" | ||
rsvg-convert "${file}" -o "${png}" | ||
|
||
elif type svgexport &>/dev/null; then | ||
|
||
# dependency: svgexport (via npm) | ||
echo "svgexport: converting ${file}" | ||
svgexport "${file}" "${png}" | ||
|
||
else | ||
echo "error: no SVG converter installed" 2>1 | ||
exit 1 | ||
fi | ||
|
||
rsvg-convert "${file}" -o "${png}" | ||
fi | ||
|
||
# Losslessly minify PNG file. | ||
pngout "${png}" -kbKGD | ||
fi | ||
done |