4
votes

I know that I can right-click on res folder, select "New > Image asset" but while it allows me to select type of added icon it assumes that I want to add an icon.

I know that I can manually generate images and move them into drawble-mdpi, drawable-hdpi, drawable-xhdpi but I assume that it is possible to automate it and supply single image that will be scaled to create lower-resolution versions.

I know about Fast ways to import drawables in Android Studio? but it was not restricted to built-in options and an accepted version is plugin that received last update in 2016 and appears to be no longer maintained - NullPointerException report received no response from maintainer.

2
What's the question exactly? it's not clear - y.allam
@y.allam I want to provide single image that Android Studio will scale to create drawble-mdpi, drawable-hdpi, drawable-xhdpi, rather than manually creating scaled images and copying them into folders. How can I improve second paragraph to clarify this? - reducing activity
i don't know about a good up-to-date tool for Android Studio, but here's a solution that i think is pretty good and needs not much effort to generate scaled drawables stackoverflow.com/a/25355105/2553984 - y.allam
@MateuszKonieczny have you used drawable-anydpi? - PN10

2 Answers

1
votes

You can use vector asset studio.You can also lookout below link:- Running Vector Asset Studio To start Vector Asset Studio:

In Android Studio, open an Android app project. In the Project window, select the Android view. Right-click the res folder and select New > Vector Asset. Some other project views and folders have this menu item as well.

Vector Asset Studio appears.

Importing an SVG or PSD file After you open Vector Asset Studio, you can import an SVG or PSD file as follows:

In Vector Asset Studio, select Local file. The file must be on a local drive. If it’s located on the network, for example, you need to download it to a local drive first.

Specify an Image file by clicking … . The image appears in the Vector Drawable Preview.

If the SVG or PSD file contains unsupported features, an error appears at the bottom of Vector Asset Studio

https://developer.android.com/studio/write/vector-asset-studio.html#running

0
votes

Unfortunately after posting and creating a bounty, I found that it was already asked as Is there a way to create xxhdpi, xhdpi, hdpi, mdpi and ldpi drawables from a large scale image?

Therefore Is there a way to create xxhdpi, xhdpi, hdpi, mdpi and ldpi drawables from a large scale image? has some useful options quoted below:

Option #1: Just ship the -xxhdpi drawables and let Android downsample them for you at runtime (downside: will only work on fairly recent devices, where -xxhdpi is known).

Option #2: Automate the process within a graphics editor, per ssantos' answer.

Option #3: Script yourself a solution, using something like ImageMagick.

(answers by CommonsWare)