Close Menu
    Facebook X (Twitter) Instagram
    Trending
    • SharePoint Internal Column Name Encoded Character List
    • Satchel Pelts List for Red Dead Redemption 2
    • Create a Video Wall With FFmpeg
    • Mitsubishi Outlander Towbar Electrics
    • Mitsubishi Outlander Towbar Installation
    • Telephone Block List
    • Hard Drive Repair After Wrong Voltage Mishap
    • How To Send Excel Workbook As Email Using Button
    YouTube Instagram Facebook RSS
    Technology Spy
    • Tutorials & Help
    • Reviews
    Technology Spy
    You are at:Home»Android»Create Intel XDK App Launch Icons with GIMP Script
    Intel XDK Mobile App Development

    Create Intel XDK App Launch Icons with GIMP Script

    0
    By Matt on September 1, 2014 Android, GIMP

    I’ve been experimenting with the Intel XDK Mobile App development system. This allows you to create mobile apps using HTML,CSS and Javascript for Android and iOS. As with any mobile development you need to provide a number of app launcher icons in a variety of resolutions.

    The following GIMP Python-fu script allows you to easily create a complete set of icons based on a single source image. These can then be loaded in to the Intel XDK before you build your app.

    Here is a set of launcher icons created using the script :

    Example Launcher Icons

    For information on adding a custom script to your GIMP Installation then please see my Installing GIMP Plugins and Scripts In Windows tutorial.

    Here is the Python script :

    #!/usr/bin/env python
    
    # GIMP Plugin - Intel XDK Launcher Icons Generator
    # Copyright (c) 2014 Matt Hawkins
    # http://www.tech-spy.co.uk/
    
    # This is Python-fu plugin for Gimp.
    # It takes the current image and creates Android Launcher icons
    # for use within the Intel XDK. You can specify a background
    # colour if your source image has transparency.
    
    # The original icon is scaled so you should start with a nice
    # high quality original. A good start is a 512x512 or 1024x1024 PNG.
    
    from gimpfu import *
    
    def python_intel_xdk_launcher_icons(image,tdrawable,background_enable,background_color,outputFolder):
      g = gimp.pdb
    
      g.gimp_message_set_handler( ERROR_CONSOLE )
    
      # Define list of pixel sizes to create
      sizes = [36,48,72,96,144,192]
      # iOS sizes
      #sizes = [60,76,120,152]
      # Windows 8 sizes
      #sizes = [30,50,150]
    
      # Set foreground and background colours
      g.gimp_context_set_background(background_color)
      g.gimp_context_set_foreground((255,255,255))
    
      for size in sizes:
        target_width=size
        target_height=size
    
        generateImage(g,tdrawable,target_width,target_height,background_enable,outputFolder)
    
    def generateImage(g,tdrawable,target_width,target_height,background_enable,outputFolder):
    
      imageX = g.gimp_image_new(target_width,target_height,0)
    
      # Create background layer
      if (background_enable==1):
        back_layer = g.gimp_layer_new(imageX,target_width, target_height, 0, "Background Layer", 100, 0)
        g.gimp_drawable_fill(back_layer, 1)
        g.gimp_image_insert_layer(imageX, back_layer, None, 0)
        g.gimp_layer_set_offsets(back_layer, 1, 1)
    
      display = g.gimp_display_new(imageX)
    
      icon_layer = g.gimp_layer_new_from_drawable(tdrawable, imageX)
      g.gimp_image_insert_layer(imageX, icon_layer, None, 0)
      g.gimp_layer_scale(icon_layer, target_width, target_height,False)
    
      # Merge and save
      temp_layer = g.gimp_image_merge_visible_layers(imageX, 1)
      g.file_png_save(imageX, temp_layer, outputFolder + "\\" + "launcher_" + str(target_width) + "x" + str(target_height) + ".png", "raw_filename", 0, 9, 0, 0, 0, 0, 0)
    
    register(
    
      "python_intel_xdk_launcher_icons",
      "Intel XDK Launcher Icons Generator",
      "Generate a set of Android launcher icons for use with the Intel XDK.",
      "Matt Hawkins",
      "Matt Hawkins",
      "2014",
      "<Image>/Filters/IntelXDK/_Launcher_Icons",
      "RGB*,GRAY*",
      [
          (PF_TOGGLE, "background_enable", "Background:", True),
          (PF_COLOR,  "background_color", "Background colour", (0, 0, 0)    ),
          (PF_DIRNAME, "outputFolder", "Output directory", "/")
      ],
    
      [],
      python_intel_xdk_launcher_icons)
    
    main()
    

    This should be named “mh_intel_xdk_launcher_icons.py” and placed in your Plugins directory. It can also be downloaded directly to your PC from my BitBucket Repository.

    Once in place you can start GIMP. The plugin will be available from the “Filters” > “TechSpy” menu.

    Load an image to use as a starting point and launch the script. You will be prompted for some options :

    Gimp Script Options

    The Background options simply determine if a coloured background layer is used. If you want your icons to maintain transparency you may want to turn this off. The output directory is where the final images will be saved.

    Click OK when ready. The script will create and then save a set of images based on the pixel sizes defined in the script using an appropriate file name. For example :

    • launcher_36x36.png
    • launcher_48x48.png
    • …

    Although I was using this script to create Android icons you can un-comment the “sizes” list definition for iOS and Windows 8 to create additional sets.

    If you need a set of Android launcher icons to load into Intel XDK for testing then feel free to download and use this example set : intel_xdk_android_launcher_icons.zip.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleLiving With A Sigma BC 1009 Cycle Computer
    Next Article ASUS M5A97 and Coolermaster Hyper 212 EVO PC Build

    Related Posts

    8.7

    Choetech Wireless Charging Pad Review

    Installing GIMP Plugins and Scripts In Windows

    Android 4.0 Status and Notification Icons

    Leave A Reply Cancel Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    109

    Recent Posts
    May 1, 2025

    SharePoint Internal Column Name Encoded Character List

    March 24, 2025

    Satchel Pelts List for Red Dead Redemption 2

    January 29, 2025

    Create a Video Wall With FFmpeg

    Categories
    • 3D Printing
    • Android
    • Arduino
    • Development
    • ESP8266
    • Excel
    • Gaming
    • General
    • GIMP
    • Home Automation
    • JavaScript
    • Linux
    • Microsoft Office
    • Mobile Devices
    • Oracle APEX
    • Python
    • Raspberry Pi
    • Reviews
    • Security
    • SharePoint
    • Tutorials & Help
    • VBScript
    Web Tools

    A set of quick and basic online tools for web designers and software developers :

    • Hash Generator
    • Text to HTML List
    • Text to HTML Table
    • URL Encoder and Decoder
    • UNIX Timestamp Calculator
    • LED Resistor Calculator
    • Extract Email from Text
    • Mortgage Calculator
    Tags
    Android APEX Apple Arduino Black Friday Coolermaster csv Elite Dangerous email ESP-01 ESP8266 EV Excel file handling Format gaming GIMP Gritin Home Assistant Home Automation Linux lists Media os.stat os.walk Outlander Power Python Qi RDR2 Review scam Security SharePoint 2010 string Syncwire text text files TrueCrypt Ubuntu USB-C VBA VBscript Windows 10 Xbox One
    About

    Welcome to Technology Spy, a site devoted to gadgets, computers, programming and all things technology! You’ll also find product reviews for items I own as well as tutorials, guides and scripts for the software I use.

    Archives
    Other Resources
    • MattsBits
    • Raspberry Pi Spy
    YouTube Facebook Instagram Pinterest RSS

    Entries RSS | Comments RSS

    Copyright © 2025 - All Rights Reserved - Matt Hawkins

    mastodon.social@MattHawkins

    Type above and press Enter to search. Press Esc to cancel.