GIMP script for creating Android icons at once

Sep 22

Written by: Goran Siric
9/22/2011 1:46 PM  RssIcon

Update 13.12.2013 (by Dieter Adriaenssens
 - added support for XXHDPI and XXXHDPI screens

Updated 13.02.2012

Added support for

 -  action bar icons
 - icons with custom size
 - xhdpi screen icon


If you are programming for Android then you know how hard is to create and manage all that icons for different screen sizes and resolutions.  I am using GIMP for creating all my icons and was trying to find script for creating all that icons at once.

The closest one I found is script for creating many PNG files with different sizes at once. That script helped me a lot in creating a this one.


How to install script for creating android icons

This script require GIMP 2.6 or higher.

Download script:  GIMP script for creating android icons

Unpack the file and copy script-fu-save-android-icon.scm file  to GIMP scripts folder. Its location depends where is GIMP installed and what version of GIMP you have. On my system this folder is: C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts

How to use script

After you install script, you need to restart GIMP or select  Filters->Script-Fu-Refresh Scripts

Now you can run script using new menu item: Script-Fu -> Android -> Save Android Icons ...

You will get following dialog:


Under Android  icons type you can select what type of android icons you want to generate:

Launcher Icons
Menu Icons
Action Bar Icons
Status Bar Icons
Tab Icons
Dialog Icons
List View Icons
Custom Icon

Resolution of saved icons will depend  of what icon type you select. 

If you select Custom Icon then you must enter desired resolution for your mdpi icon as baseline icon dimension. Other icon will be scaled according to icon design guidelines:

- ldpi icon will be 0.75 x width and height of  mdpi icon
        - hdpi will be 1.5 x width and height of mdpi icon
- xhdpi icon will be 2.0 x width and height of  mdpi icon

With Save mode options you can select whether you want to save icons under same name but in different folders with standard android folder names  (drawable-ldpi,drawable-mdpi, drawable-hdpi, drawable-xhdpi) or you want to save all icons in same folder but with added resolution to the end of the file name. 

If you select first options you must be sure that drawable-ldpi,drawable-mdpi, drawable-hdpi and drawable-xhdpi folders exists under Root folder you select later.

If you check Use android naming conventions then all icon names will be prefixed with common icon prefix for selected icon type.

Here you can find more about designing icons for Android: Android Icon Design Guidelines

Rest of the options are standard for saving PNG files and I think you will not have problem with them.

I hope you will find this script useful and feel free to leave comments and requests for improvement.


Download 

Script can be downloaded here:  GIMP script for creating android icons

29 comment(s) so far...


Gravatar

Re: GIMP script for creating Android icons at once

This is a great script. Please include the instructions on this page in the zip file. I have made a pdf file of them. If you are interested, I can email the file to you.

By Mark Lasby on   9/24/2011 8:36 PM
Gravatar

Re: GIMP script for creating Android icons at once

Sure, you can send me pdf with instructions at goran.siric@izvornikod.com

By Goran Siric on   9/24/2011 9:32 PM
Gravatar

Re: GIMP script for creating Android icons at once

Your script is very good and was exactly what I look for !

I test it with Gimp 2.2 and it is not working. It's ok in 2.6.
You should remove 2.0 in your blog as it is confusing, or better say that it need 2.6 or upper.

I have another little pb, my android eclipse version creates res directory with drawable-xxxx and not xxxx directly. I think it's a new way to do from google.

Great script anyway.

I talk (in french on my blog): histoires-android.blogspot.com/2011/09/creer-des-icones-android-en-un-seul.html

Bue,
Vicnet

By Vicnet on   9/30/2011 7:01 PM
Gravatar

Re: GIMP script for creating Android icons at once

Thank you for your feedback. I updated script to save icons in drawable-xxxx folders.

By Goran Siric on   10/3/2011 8:36 AM
Gravatar

Re: GIMP script for creating Android icons at once

me too ;-)

By Vicnet on   10/3/2011 5:46 PM
Gravatar

Re: GIMP script for creating Android icons at once

Today I noticed that in some cases sizes of generated icon are not correct. After some research I found the problem. If image have one or more layers with size different then image, then generated icons have size which corespond to layer size and not the image size. To fix that script is updated with command to set size of all layers to image size.

Also I noticed that sizes for generating tab icons are wrong. That is fixed too.

By Goran Siric on   10/12/2011 10:22 AM
Gravatar

Re: GIMP script for creating Android icons at once

Great scrip man. I tried it with menu icons and got a great result in a second.
But when I applied it to status bar icons it didn't add the layer effects recommended by Android status bar icon design guidelines, or was it me using it in a wrong way?
Finally, I see that your script has great potential :)

By Motsha on   10/21/2011 6:17 AM
Gravatar

Re: GIMP script for creating Android icons at once

Script currently use your image only as a template to create android icons with preffered dimensions. It does not add any effect or something like that. You need to create image with transparency and all efects you want and then use this script to save icons with different sizes.

I was thinking about adding some functionality to apply some style and colors to image before creating icons for status bar icons and tab icons, but in most cases you will not get desired result. I think that it is better to create icons on your own, with styles and effects you want.

By Goran Siric on   10/21/2011 8:44 AM
Gravatar

Re: GIMP script for creating Android icons at once

Thank you SO MUCH!!!
I found the script you mentioned first but didn't have the skills to adjust it so it fitted my needs. You did it for me: THANKS!

Don't know if it is too much to ask. But what if you add a custom "Android Icon Type" that just scales the other pictures (mdpi and ldpi) according to the hdpi. So say I have an image that I want to have a size of 100x80px in the hdpi folder -> then it scale it down to 66% (48/72) of that and put it in the mdpi -> then it scales that mdpi image down to 75% (36/48) and put it in the ldpi.
My experience tells me that it is better to scale a this step-wise way than to scale the biggest down to the smallest.

(My next goal is to find an easy plugin in eclipse that allows me to add all the images to each of the drawable folders with much more ease than the drag and dropping- yes I'm lazy programmer)

By Norfeldt on   1/26/2012 12:55 PM
Gravatar

Re: GIMP script for creating Android icons at once

Hi Norfeldt,

I am little busy this days, but will try to add that functionality for custom icon type next week.
According to android guidelines mdpi icon is baseline, and then ldpi,hdpi and xhdpi icons are scaled based on mdp. I will also add xhdpi icon type. For your next goal – did you know that you can save icons directly in your working project folder, and eclipse will automatically add them to the project ?

By Goran Siric on   1/26/2012 3:35 PM
Gravatar

Re: GIMP script for creating Android icons at once

Hello.
Nice work.
But, the xhdpi icones are not created.
"96x96 for extra high-density"
developer.android.com/guide/practices/screens_support.html
Thanks.

By Jean-Paul laville on   2/2/2012 2:30 PM
Gravatar

Re: GIMP script for creating Android icons at once

Hello all,
script is updated with some new features.

Added support for:
- action bar icons
- icons with custom size
- xhdpi screen icon

I hope that there is no bugs introduced.

Enjoy

By Goran Siric on   2/13/2012 12:23 PM
Gravatar

Re: GIMP script for creating Android icons at once

Thank you so much! Have donated some money to you so you can buy yourself a good beer.
You deserve it!

By Norfeldt on   2/13/2012 5:10 PM
Gravatar

Re: GIMP script for creating Android icons at once

Thank you for supporting me :)

By Goran Siric on   2/16/2012 10:44 AM
Gravatar

Re: GIMP script for creating Android icons at once

sorry for writing in English I am French but I vien to find thanks to google finally information on the subject that I currently work thank you for sharing good information thanks to you I will advance 'll see you soon I'll follow you to the next and I recommend reading your blog friendly

By davidle francais on   2/29/2012 11:47 AM
Gravatar

Re: GIMP script for creating Android icons at once

Great script! I love it.

By Rick on   9/7/2012 9:34 PM
Gravatar

Re: GIMP script for creating Android icons at once

I'm running OSX Mountain Lion and Gimp 2.8. I followed your instructions above to install the plugin, but the filter is not showing up. Are there any extra steps I need to perform to enable the filter? I tried restarting GIMP and selecting to refresh scripts, but neither seemed to work. Any help would be appreciated.

By Brian Anderson on   9/13/2012 7:42 PM
Gravatar

Re: GIMP script for creating Android icons at once

Hi Brian,please try to follow this tutorial for adding GIMP scripts on Mac:

www.gimptalk.com/index.php?/topic/36105-adding-scripts-to-gimp-using-a-mac-easy-10-step-tutorial/

Note that in step four you don't need to download script from the link in article, just use already downloaded script for creating Androind icons.

Or you can try following:
The scripts are kept inside the application resource package:
Go to the Gimp application and control-click on it;
select 'Show Package Contents';
go to Contents>Resources>share>gimp>2.0>scripts;
and insert the wanted script.
If Gimp is running, activate the script by going to Filters in the menu and select Script-Fu>Refresh Scripts.

By Goran Siric on   9/17/2012 11:58 AM
Gravatar

Re: GIMP script for creating Android icons at once

Thanks!!!

By Roy on   12/19/2012 7:43 AM
Gravatar

Re: GIMP script for creating Android icons at once

Just wanted to say that this script was a great help to me! Nice work. :-)

By robpvn on   1/31/2013 12:46 PM
Gravatar

Re: GIMP script for creating Android icons at once

Hello,

very nice script, thank you for it!!!

Want to ask if you can add support for xxhdpdi icons with 144x144 pixels and 96 dpi?

Peter

By Peter on   3/8/2013 6:02 PM
Gravatar

Re: GIMP script for creating Android icons at once

I suggest to name the menu "Android -> Save icons..." so it saves one click each time.

Peter

By Peter on   3/8/2013 6:14 PM
Gravatar

Re: GIMP script for creating Android icons at once

It would be worthwhile to use DIR-SEPARATOR instead of "/" so this will work on (cough) Windows.

By Michel on   4/26/2013 7:29 PM
Gravatar

Re: GIMP script for creating Android icons at once

Thanks!

By Ken on   11/14/2013 7:41 PM
Gravatar

Re: GIMP script for creating Android icons at once

I add support for the xxhdpi and xxxhdpi screen sizes to the script.
Do you have a public repo of this script where I can create a pull/merge request with the changes?

By ruleant on   12/13/2013 8:09 PM
Gravatar

updated script

I created a repo in github [0] with my changes (xxhdpi and xxxhdpi support) added to your script, feel free to clone it : github.com/ruleant/script-fu-save-android-icons
I'm happy to transfer this repo to you if you have a github account.

By ruleant on   12/16/2013 8:41 PM
Gravatar

Re: GIMP script for creating Android icons at once

Hi Dieter,thanks for update.

By Goran Siric on   1/28/2014 10:33 AM
Gravatar

Re: GIMP script for creating Android icons at once

Thanks for this script, but it doesn't works on windows as it use slash instead of antislash for paths

By giova on   8/18/2014 10:35 AM
Gravatar

Re: GIMP script for creating Android icons at once

It didn't work for me. I always get this error message

Error while executing script-fu-save-android-icons:

Error: ( : 53244862) Procedure execution of file-png-save2 failed: Could not open 'C:\Users\dgp\Desktop/drawable-ldpi/fb.png' for writing: No such file or directory

By Dennis on   8/26/2014 6:52 PM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 

Search Blog

If you found this useful,
you can buy me a coffe :)
By me a coffe through PayPal :)

Featured articles

Android "DataEntry ListView" Design Pattern

Have you realized the importance of ListView control in developing android applications ?

GIMP script for creating Android icons at once

Script for creating Android icons for different screen resolutions at once. Icons can be saved using standard Android icons naming conventions and saved in appropriate folders.

Creating Android button with image and text using relative layout

Source code with examples how to use relative layout to create nice buttons with text and images in Android

Android application and the Internet

Tutorial about connecting to the web pages on the Internet from Android application, using both POST and GET web requests.

Recent Entries

Comments about Parking SMS Scheduler
Comments about cities and parking zones
Android "DataEntry ListView" Design Pattern
Android application and the Internet
Keep my DNN site alive
Android default icons

Recent Comments

Re: GIMP script for creating Android icons at once
It didn't work for me. I always get this error message

Error while executing script-fu-save-android-icons:

Error: ( : 53244862) Procedure execution of file-png-save2 failed: Could not open 'C:\Users\dgp\Desktop/drawable-ldpi/fb.png' for writing: No such file or directory
Re: Creating Android button with image and text using relative layout
Maybe a noob question but how can center the text and images within the button?
Re: GIMP script for creating Android icons at once
Thanks for this script, but it doesn't works on windows as it use slash instead of antislash for paths
Re: Creating Android button with image and text using relative layout
Never mind, I can't post suffice it to say, you are doing it the hard way.
Re: Creating Android button with image and text using relative layout
Why don't you just formulate your XML like this



android:layout_width="wrap_content"
android:src="@drawable/icon"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
ImageView>

TextView>

TextView>


include like this


include>

and find it like this

RelativeLayoutButton button1 = (RelativeLayoutButton)this.findViewById(R.id.button1);