mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-15 09:24:03 +00:00
35 lines
591 B
Bash
Executable File
35 lines
591 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# USAGE
|
|
|
|
# ./convertToIco <input png or ico> <outfilename>.ico
|
|
# Example
|
|
# ./convertToPng ~/sample.png ~/converted.ico
|
|
|
|
set -e
|
|
|
|
type convert >/dev/null 2>&1 || { echo >&2 "Cannot find required ImageMagick Convert executable"; exit 1; }
|
|
|
|
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}" == "ico" ]; then
|
|
cp "${SOURCE}" "${DEST}"
|
|
exit 0
|
|
fi
|
|
|
|
convert "${SOURCE}" -resize 256x256 "${DEST}"
|