Create app icons with Image Asset Studio

Android Studio includes a tool called Image Asset Studio that helps you generate your own app
icons from
material icons,
custom images, and text strings. It generates a set of icons at the appropriate resolution
for each pixel
density that your app supports.
Image Asset Studio places the newly generated icons in density-specific folders under the
res/ directory in your project. At runtime, Android uses the appropriate
resource based on the screen density of the device your app is running on.

Image Asset Studio helps you generate the following icon types:

Launcher icons

Action bar and tab icons

Notification icons

About Image Asset Studio

Image Asset Studio helps you create various types of icons at different densities and
shows you exactly where they'll be placed in your project. The following sections describe the
icon types that you can create and the image and text inputs that you can use.

Adaptive and legacy launcher icons

A launcher icon is a graphic that represents your app to users. It can:

Appear in the list of apps installed on a device and on the Home screen.

Adaptive launcher icons can display as a variety of shapes across different device models and are
available in Android 8.0 (API level 26) and higher. Android Studio 3.0 introduces support for
creating adaptive icons using Image Asset Studio. Image Asset Studio generates previews of an
adaptive icon in circle, squircle, rounded square, and square shapes, as well as a full bleed
preview of the icon. Image Asset Studio also generates legacy, round, and Google Play Store
previews of the icon. A legacy launcher icon is a graphic that represents your app on a device's
home screen and in the launcher window. Legacy launcher icons are intended for use on devices
running Android 7.1 (API level 25) or lower, which don't support adaptive icons, and don't display
as varying shapes across device models.

Image Asset Studio places the icons in the proper locations in the
res/mipmap-density/ directories. It also creates a 512 x 512 pixel image
that's appropriate for the Google Play store.

We recommend that you use the material design style for launcher icons,
even if you support older Android versions.

Image Asset Studio places the icons in the proper locations in the
res/drawable-density/
directories.

We recommend that you use the material design style for action bar
and tab icons, even if you support older Android versions. Use appcompat and other
support libraries
to deliver your material design UI to older platform versions.

As an alternative to Image Asset Studio, you can use
Vector Asset Studio to create action bar and
tab icons. Vector drawables are appropriate for simple icons and can reduce the size of your
APK.

Notification icons

A notification is a message that you can display to the user outside of the normal UI of your
app. Image Asset Studio places notifications icons in the proper locations in the
res/drawable-density/ directories:

Clip art

Image Asset Studio makes it easy for you to import Google material icons in VectorDrawable and
PNG formats: simply select an icon from a dialog. For more information, see
Material Icons.

Images

You can import your own images and adjust them for the icon type. Image Asset Studio supports
the following file types: PNG (preferred), JPG (acceptable), and GIF (discouraged).

Text strings

Image Asset Studio lets you type a text string in a variety of fonts, and places it on an icon.
It converts the text-based icon into PNG files for different densities. You can use the fonts that
are installed on your computer.

In the Background Layer tab, select an Asset Type, and then
specify the asset in the field underneath. You can either select a color or
specify an image to use as the background layer.

In the Legacy tab, review the default settings and confirm you want
to generate legacy, round, and Google Play Store icons.

Optionally change the name and display settings for each of the
Foreground Layer and Background Layer tabs:

Name - If you don't want to use the default name, type a new
name. If that resource name already exists in the project, as indicated
by an error at the bottom of the wizard, it's overwritten. The name can
contain lowercase characters, underscores, and digits only.

Trim - To adjust the margin between the icon graphic and border
in the source asset, select Yes. This operation removes
transparent space, while preserving the aspect ratio. To leave the
source asset unchanged, select No.

Color - To change the color for a Clip Art or
Text icon, click the field. In the Select Color dialog,
specify a color and then click Choose. The new value appears in
the field.

Resize - Use the slider to specify a scaling factor in percent
to resize an Image, Clip Art, or Text icon. This
control is disabled for the background layer when you specify a
Color asset type.

Click Next.

Optionally, change the resource directory: Select the resource source set
where you want to add the image asset: src/main/res,
src/debug/res, src/release/res, or a custom source set.
The main source set applies to all build variants, including debug and
release. The debug and release source sets override the main source set and
apply to one version of a build. The debug source set is for debugging only.
To define a new source set, select
File > Project Structure > app > Build Types.
For example, you can define a beta source set and create a version of an
icon that includes the text "BETA" in the bottom right corner. For more
information, see
Configure
Build Variants.

Click Finish. Image Asset Studio adds the images to the
mipmap folders for the different densities.

In the Path field, specify the path and file name of the image.
Click ... to use a dialog.

In the Text field, type a text string and select a font.

The icon appears in the Source Asset area on the right side, and in the
preview area at the bottom of the wizard.

Optionally change the name and display settings:

Name - If you don’t want to use the default name, type a new name.
If that resource name already exists in the project, as indicated by an error at
the bottom of the wizard, it's overwritten.
The name can contain lowercase
characters, underscores, and digits only.

Trim - To adjust the margin between the
icon graphic and border in the source asset, select Yes. This operation
removes transparent space, while
preserving the aspect ratio. To leave the source asset unchanged, select
No.

Padding - If you want to adjust the
source asset padding on all four sides, move the slider. Select a value between
-10% and 50%. If you also
select Trim, the trimming happens first.

Foreground - To change the foreground color for a
Clip Art or Text icon, click the field.
In the Select Color dialog, specify a color and then
click Choose. The new value appears in the field.

Background - To change the background color, click the field.
In the Select Color dialog, specify a color and then
click Choose. The new value appears in the field.

Scaling - To fit the icon size, select Crop or
Shrink to Fit. With crop, the image edges can be cut off, and with shrink,
they aren't. You can adjust the padding, if needed, if the source asset still doesn't fit
well.

Shape - To place a backdrop behind your source asset, select a shape,
one of circle, square, vertical rectangle, or horizontal rectangle. For a transparent
backdrop, select None.

Effect - If you want to add a dog-ear
effect to the upper right of a square or rectangle shape, select DogEar.
Otherwise, select None.

Image Asset Studio places the icon within a transparent square so there's some padding
on the edges. The padding provides adequate space for the standard drop-shadow icon effect.

Click Next.

Optionally change the resource directory:

Res Directory - Select the resource source set where you want to add the
image asset: src/main/res, src/debug/res,
src/release/res,
or a user-defined source set. The main source set applies to all build variants, including
debug and release. The debug and release source sets override the main source set and apply
to one version of a build. The debug source set is for debugging only. To define a new source
set, select File > Project Structure > app >
Build Types. For example, you could define a beta source set and create a
version of an icon that includes the text "BETA" in the bottom right corner.
For more information, see
Configure Build Variants.

The Output Directories area displays the images and the folders
where they will appear in
Project Files view of the
Project window.

Click Finish.

Image Asset Studio adds the images to the mipmap folders for
the different densities.

In the Path field, specify the path and file name of the image.
Click ... to use a dialog.

In the Text field, type a text string and select a font.

The icon appears in the Source Asset area on the right side, and in the
preview area at the bottom of the wizard.

Optionally change the name and display options:

Name - If you don’t want to use the default name, type a new name.
If that resource name already exists in the project, as indicated by an error at
the bottom of the wizard, it's overwritten.
The name can contain lowercase
characters, underscores, and digits only.

Trim - To adjust the margin between the
icon graphic and border in the source asset, select Yes. This operation
removes transparent space, while
preserving the aspect ratio. To leave the source asset unchanged, select
No.

Padding - If you want to adjust the
source asset padding on all four sides, move the slider. Select a value between -10% and 50%.
If you also select Trim, the trimming happens first.

Theme - Select
HOLO_LIGHT
or HOLO_DARK.
Or, to specify a color in the Select Color dialog, select
CUSTOM and then click the Custom color field.

Image Asset Studio creates the icon within a transparent square so there's some padding
on the edges. The padding provides adequate space for the standard drop-shadow icon effect.

Click Next.

Optionally change the resource directory:

Res Directory - Select the resource source set where you want to add the
image asset: src/main/res, src/debug/res,
src/release/res,
or a user-defined source set. The main source set applies to all build variants, including
debug and release. The debug and release source sets override the main source set and apply
to one version of a build. The debug source set is for debugging only. To define a new source
set, select File > Project Structure > app >
Build Types. For example, you could define a beta source set and create a
version of an icon that includes the text "BETA" in the bottom right corner.
For more information, see
Configure Build Variants.

The Output Directories area displays the images and the folders
where they will appear in
Project Files view of the
Project window.

Click Finish.

Image Asset Studio adds the images in the drawable folders for
the different densities.

In the Path field, specify the path and file name of the image.
Click ... to use a dialog.

In the Text field, type a text string and select a font.

The icon appears in the Source Asset area on the right side, and in the
preview area at the bottom of the wizard.

Optionally change the name and display options:

Name - If you don’t want to use the default name, type a new name.
If that resource name already exists in the project, as indicated by an error at
the bottom of the wizard, it's overwritten.
The name can contain lowercase
characters, underscores, and digits only.

Trim - To adjust the margin between the
icon graphic and border in the source asset, select Yes. This operation
removes transparent space, while preserving the aspect ratio. To leave the source asset
unchanged, select No.

Padding - If you want to adjust the
source asset padding on all four sides, move the slider. Select a value between
-10% and 50%. If you also
select Trim, the trimming happens first.

Image Asset Studio creates the icon within a transparent square so there's some padding
on the edges. The padding provides adequate space for the standard drop-shadow icon effect.

Click Next.

Optionally change the resource directory:

Res Directory - Select the resource source set where you want to add the
image asset: src/main/res, src/debug/res,
src/release/res,
or a user-defined source set. The main source set applies to all build variants, including
debug and release. The debug and release source sets override the main source set and apply
to one version of a build. The debug source set is for debugging only. To define a new source
set, select File > Project Structure > app >
Build Types. For example, you could define a beta source set and create a
version of an icon that includes the text "BETA" in the bottom right corner.
For more information, see
Configure Build Variants.

The Output Directories area displays the images and the folders
where they will appear in
Project Files view of the
Project window.

Click Finish.

Image Asset Studio adds the images in the drawable folders for
the different densities and versions.

Refer to an image resource in code

You can normally refer to an image resource in a generic way in your code, and when
your app runs, the corresponding image displays automatically depending on the
device:

In most cases, you can refer to image resources as @drawable in XML code or
Drawable
in Java code.

For example, the following layout XML code displays the drawable in an
ImageView:

After you have an image resource in the res/ directory of your project, you can
reference it from your Java code or your XML layout using its resource ID.
The following Java code sets an
ImageView to use
the drawable/myimage.png resource:

Java

For launcher icons, the AndroidManifest.xml file must reference
the mipmap/ location. Image Asset Studio adds this code automatically.
The following manifest file code references the
ic_launcher icon in the mipmap/ directory:

Optionally select options to find where the icon is used in the project, and click
OK.

Android Studio deletes the files from the project and the drive. However, if you chose to search
for places in the project where the files are used and some usages are found, you can view them and
decide whether to delete them. You must delete or replace these references to be able to
successfully compile your project.

Select Build > Clean Project.

Android Studio removes any generated image files corresponding to the deleted image resource.
It removes them from the project and the drive.

If needed, correct any remaining errors due to portions of the code that reference the
resource.

Android Studio highlights these errors in your code. When you've removed all references from
your code, you can successfully build your project again.

Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.