2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-19 02:55:12 +00:00
nativefier/icon-scripts/convertToTrayIcon
2021-04-28 20:25:15 -04:00

33 lines
540 B
Bash
Executable File

#!/usr/bin/env bash
# USAGE
# ./convertToTrayIcon <input png or icns> <outfilename>.png
# Example
# ./convertToTrayIcon ~/sample.icns ~/converted.png
set -e
SOURCE=$1
DEST=$2
if [ -z "${SOURCE}" ]; then
echo "No source image specified"
exit 1
fi
if [ -z "${DEST}" ]; then
echo "No destination specified"
exit 1
fi
NAME=$(basename "${SOURCE}")
EXT="${NAME##*.}"
if [ "${EXT}" == "png" ]; then
cp "${SOURCE}" "${DEST}"
exit 0
fi
sips --setProperty format png --resampleHeightWidth "256" "256" "${SOURCE}" --out "${DEST}"