Imdad
Imdad

Reputation: 769

Creating Android resource images sizes

So I need to create images to be part of my app that I'm making. I haven't found the answer anywhere.

What I am wondering is...

If I created an image that is to be displayed on Activity1, then what image size in PIXELS should I created the initial image at?

The initial image would then be resized to their corresponding DPI to work well on Android phones.

I may be doing this wrong in creating images so they don't lose their quality, any ideas?

If I am doing this wrong, then please can someone advise on the best practice on creating Android images in pixels and then converting to DPI later after the initial image?

Thank you! :)

EDIT: This question is different because I'm mainly talking about keeping image quality by making the image big first and then downsizing.

Upvotes: 1

Views: 1892

Answers (2)

imti
imti

Reputation: 1293

To generate image for Android device you can follow this as I do: To create alternative bitmap drawables for different densities, you should follow the 3:4:6:8:12:16 scaling ratio between the six generalized densities. For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:

  • 36x36 (0.75x) for low-density
  • 48x48 (1.0x baseline) for medium-density
  • 72x72 (1.5x) for high-density
  • 96x96 (2.0x) for extra-high-density
  • 144x144 (3.0x) for extra-extra-high-density
  • 192x192 (4.0x) for extra-extra-extra-high-density (launcher icon only; see note above)

​Or,

Image resolution and DPI are tightly coupled each other. There is a 3:4:6:8 scaling ratio in drawable size by DPI.

  1. LDPI - 0.75x
  2. MDPI - Original size
  3. HDPI - 1.5x
  4. XHDPI - 2.0x
  5. XXHDPI - 3x
  6. XXXHDPI - 4.0x ​

For example if a 100x100 image is a baseline (MDPI),

  1. LDPI - 75x75
  2. HDPI - 150x150
  3. XHDPI - 200x200
  4. XXHDPI - 300x300
  5. XXXHDPI - 400x400

and so on. ​​

Upvotes: 1

Sujit Yadav
Sujit Yadav

Reputation: 2735

You have to create six generalized size image densities:

  • ldpi (low) ~120dpi
  • mdpi (medium) ~160dpi
  • hdpi (high) ~240dpi
  • xhdpi (extra-high) ~320dpi
  • xxhdpi (extra-extra-high) ~480dpi
  • xxxhdpi (extra-extra-extra-high) ~640dpi

For more detail check out this link

Upvotes: 1

Related Questions