Archive
Highlighted

How do I automatically build out proper size icons for a Splunk app with a single file using OS X?

Splunk Employee
Splunk Employee

I want to automatically create all of the proper icon sizes with a single file, using OS X.

0 Karma
Highlighted

Re: How do I automatically build out proper size icons for a Splunk app with a single file using OS X?

Splunk Employee
Splunk Employee

With OS X, you can adjust this script to your liking. Please comment with solutions for any other OS:

#!/bin/bash
### Create all of the proper size icons for a Splunk App from a given "Icon"
### - Icon must be in your downloads folder
### - Icon must be named the same as the Splunk App folder name 

### SPLUNK variables
SPLUNK_APPS="/opt/splunk/etc/apps/"
DOWNLOADS="/Users/jdonn/Downloads/"
PERMISSIONS="jdonn:staff"

### Collect and test for Icon 
if [ "$#" -eq 0 ];then
  echo "Please state the name of the Icon"
  exit 0
elif [ "$#" -gt 1 ];then
  echo "Just ONE Icon at a time"
  exit 0
    else
      echo "on we go" 
      ICON=$BASH_ARGV
      APP=`echo $ICON | cut -d'.' -f1`
      # echo "App path = $SPLUNK_APPS$APP/static/"
    fi

# exit 0

### 36 x 36
sips -Z 36 $DOWNLOADS$ICON --out $SPLUNK_APPS$APP/static/appIcon.png 
sips -Z 36 $DOWNLOADS$ICON --out $SPLUNK_APPS$APP/static/appIconAlt.png

### 72 x 72 
sips -Z 72 $DOWNLOADS$ICON --out $SPLUNK_APPS$APP/static/appIcon_2x.png
sips -Z 72 $DOWNLOADS$ICON --out $SPLUNK_APPS$APP/static/appIconAlt_2x.png

### 160 x 40
sips -Z 40 $DOWNLOADS$ICON --out $SPLUNK_APPS$APP/static/appLogo.png

### 320 x 80
sips -Z 80 $DOWNLOADS$ICON --out $SPLUNK_APPS$APP/static/appLogo_2x.png

### Permissions
chown $PERMISSIONS $SPLUNK_APPS$APP/static/*

exit 0

View solution in original post