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!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...