Dashboards & Visualizations

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

jdonn_splunk
Splunk Employee
Splunk Employee

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

0 Karma
1 Solution

jdonn_splunk
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

jdonn_splunk
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
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...