mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-24 19:10:22 +00:00
41 lines
632 B
Plaintext
41 lines
632 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
# USAGE
|
||
|
|
||
|
# ./convertToIco <input png or ico> <outfilename>.ico
|
||
|
# Example
|
||
|
# ./convertToPng ~/sample.png ~/converted.ico
|
||
|
|
||
|
set -e
|
||
|
|
||
|
IMAGEMAGICK_CONVERT=$(which convert)
|
||
|
|
||
|
if [ ! -x "${IMAGEMAGICK_CONVERT}" ]; then
|
||
|
echo "Cannot find required ImageMagick Convert executable" >&2
|
||
|
exit 1;
|
||
|
fi
|
||
|
|
||
|
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##*.}"
|
||
|
BASE="${NAME%.*}"
|
||
|
|
||
|
if [ "${EXT}" == "ico" ]; then
|
||
|
cp "${SOURCE}" "${DEST}"
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
convert "${SOURCE}" "${DEST}"
|