Create drawables from a large scale image automatically

Rajat Kumar Gupta
Code Yoga
Published in
2 min readMay 1, 2018

There are many times that we need to get the xxhdpi, xhdpi, hdpi, mdpi and ldpi drawables from a large scale png or jpg image. Although there are several options that would involve uploading pictures to some website and the website itself would do that for you it is always a hassle to get out of android studio, find the images, open the browser and uploading it. This on the other hand is a one time solution that requires only one plugin to be downloaded and you can use it everyday in your other projects.

Introducing the Android Drawable Importer plugin. It is supereasy to use and can help you save development time. This guide will cover the installation and usage of this plugin.

Downloading the plugin

  1. Open Android studio. Go to File>Settings>Plugins>Browse Repositories.
  2. Search for “Android Drawable Importer” in the search box
Install the Android Drawable Importer plugin by CODE TOOLS by clicking on the green install button on the right hand side.(Since i have already installed it doesnt appear in the above screenshot)

3. Once the downloading completes restart Android Studio

Using the plugin

  1. Now download an image and put it inside the drawable folder of your project in Android Studio
We will work on the highlighted one here

2. Right click on drawable folder>New>Batch Drawable Import

3. Now choose to drag and drop your file or click on the plus icon to find it in the search explorer.

Once you have selected the file you will get this popup. Hit the okay button

4. Continue hitting the okay button in the consecutive popups.

5. Congratulations!! You have successfully converted your large scale image into different sizes supported for different screens.

Conclusion

That’s all everyone. If you liked the solution feel free to clap for this article and add comments. They act as a source of encouragement to write more to help the community out there.

--

--