Skip to content

Commit

Permalink
Add script to generate the all-desktop.png image
Browse files Browse the repository at this point in the history
Fix #27.
  • Loading branch information
alrra committed Jul 8, 2013
1 parent ede8529 commit 77ad614
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions generate-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

# This script automatically generates the `all-desktop.png` image, but in
# order for it to work, you will need to have `ImageMagick Command-Line
# Tools` installed: http://www.imagemagick.org/script/command-line-tools.php.

generate_img() {

local outputImgName=""

if [ $(is_installed "convert") -eq 1 ]; then

outputImgName="$1"
shift

# `convert` command options:
# http://www.imagemagick.org/script/convert.php#options

convert $@ \
-background transparent \
-gravity center \
-resize 512x512 \
-extent 562x562 \
+append \
$outputImgName \
&& print_success_msg "Done! 🍻 "

else
print_error_msg "Please install ImageMagick Command-Line Tools!"
fi

}

is_installed() {

# 0 = not installed
# 1 = installed

printf "$( [[ -x "$(command -v "$1")" ]] && printf "1" || printf "0" )"
}

print_error_msg() {
print_msg "$1"
}

print_msg() {
printf "\n %s\n\n" "$1"
}

print_success_msg() {
print_msg "$1"
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

generate_img "all-desktop.png" \
"chrome.png" "firefox.png" "ie-256.png" "opera.png" "safari.png"

0 comments on commit 77ad614

Please sign in to comment.