code: protected static int getBytesPerPixel(Bitmap.Config config) {
          if (config == Bitmap.Config.ARGB_8888) {
              return 4;
          } else if (config == Bitmap.Config.RGB_565) {
              return 2;
          } else if (config == Bitmap.Config.ARGB_4444) {
              return 2;
          } else if (config == Bitmap.Config.ALPHA_8) {
              return 1;
          }
          return 1;
      }
docs: Return the byte usage per pixel of a bitmap based on its configuration.
  
  @param config The bitmap configuration.
  @return The byte usage per pixel.