What image formats should be used in the application for Android?

I am writing a game for Android, and I was wondering which images I should use for game graphics.

I told the client to create the cover in the highest possible (and reasonable) resolution, and I will reduce it, but recently I was told that SVG will be better than regular PNG , for example, since there are many resolutions used by Android devices, and the images need to be scaled . Most of the graphics will be fixed backgorunds or objects, but there will be some animations. I will use AnimationDrawable for this.

Is there a general rule for image file formats (I checked the Android developer site but didn't find anything) or just go with I have at the moment?

+8
java android graphics
source share
2 answers

Recently, I was told that SVG will be better than a simple PNG, for example

Android does not support SVG natively. There are third-party libraries that support SVG, such as this one .

since there are many resolutions for Android devices, and the images need to be scaled

If this is literally what your graphic designer told you, you need to hire another graphic designer. Fast.

Resolution is usually meaningless. Screen size is important and, more importantly, for graphics, screen density. Android supports several versions of the image for different densities, and also allows you to reprogram images from one density to another, so you can "dial" the number of densities that you want to support directly. Here 's a blog post from yesterday regarding screen density, and there is a lot of material in the Android documentation.

Now your graphic designer can use SVG "internally" and create PNG files with scaled density for your use - this is quite reasonable.

+4
source share

Is there a general rule for image file formats

Yes here . It says:

Android supports raster files in three formats: .png (preferred), .jpg (acceptable), .gif (not recommended).

There is no native support for SVG drawings, but there are libraries that support SVG

See SVG Support on Android

Usually you convert SVG images to pixel images for each density. Android also defines some standard sizes for icons such as Menu Icons.

Having sources for the images that you use as SVG is a good idea. SVG and other vector graphics usually scale better for different sizes than pixel graphics. Especially if you need to enlarge the image (for example, for hi-res icons used in the Play store).

Also be careful with AnimationDrawable , it is not intended for full-screen animations. Just small animated icons, etc.

+1
source share

All Articles