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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...