Resizing images for different android screen densities

Resizing images to look good in different android screen densities can be tricky.
There are a few "density buckets" in android, they are: LDPI, MDPI, HDPI, XHDPI, XXHDPI and XXXHDPI.
PPI and DPI are basically the same for these calculations, they mean pixels or dots per inch.
Use these steps to get the best results:
  • Resize the image to be the smallest possible size that still looks good on the device you're testing on.
  • Find out the DPI of the device you are testing on by googling "device model PPI", for example, googling "moto g 2014 ppi" gives out 294 PPI.
  • Choose the correct density bucket your device is closest to:
    • LPDI – 0.75 * MDPI size (120 PPI)
    • MDPI – default (160 PPI)
    • TVDPI - 1.33 * MDPI size (213 PPI)
    • HDPI – 1.5 * MDPI size (240 PPI)
    • XHDPI – 2 * MDPI size (320 PPI)
    • XXHDPI – 3 * MDPI size (480 PPI)
      1. XXXHDPI – 4 * MDPI size (640 PPI)
    • Resize your image for all other sizes using the ratios between the buckets, for example: to move from XHDPI to HDPI, multiply by the ratio between the two buckets: 240 divided by 320 is 0.75, so the HDPI image should be 0.75 the size of the XHDPI one.
    • Notice that the steps are not consistent:
      • the jump from XHDPI to XXHDPI is 1.5 = 480/320
      • the jump from XXHDPI to XXXHDPI is 1.33 = 640/480