1

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.

Imdad
  • 769
  • 1
  • 11
  • 31
  • 1
    Possible duplicate of [Android, images and dpi](http://stackoverflow.com/questions/4241182/android-images-and-dpi) – SushiHangover Aug 28 '16 at 19:13
  • 1
    See the duplicate answer I linked, also review Google's Best Practices for Supporting Multiple Screens : https://developer.android.com/guide/practices/screens_support.html – SushiHangover Aug 28 '16 at 19:15
  • Not a duplicate as explained in EDIT. :) – Imdad Aug 28 '16 at 20:29
  • 1
    Where is this "image" coming from? If it is from your App bundle, you should pre-create multiple versions and follow google's BP on using the different drawable folders, if you are "fetching" this image, and wish to downsize it for the screen (or for performance/memory/...reasons) see these SO QA for pixel/DP conversion : http://stackoverflow.com/questions/4605527/converting-pixels-to-dp – SushiHangover Aug 28 '16 at 20:40

2 Answers2

1

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

Sujit Yadav
  • 2,697
  • 1
  • 15
  • 17
1

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. ​​

imti
  • 1,283
  • 1
  • 11
  • 12