private static Bitmap.Config getSafeConfig(Bitmap bitmap) {
      return bitmap.getConfig() != null ? bitmap.getConfig() : Bitmap.Config.ARGB_8888;
    }
Rotate and/or flip the image to match the given exif orientation.

@param toOrient The bitmap to rotate/flip.
@param pool A pool that may or may not contain an image of the necessary dimensions.
@param exifOrientation the exif orientation [1-8].
@return The rotated and/or flipped image or toOrient if no rotation or flip was necessary.
core/src/main/java/com/bumptech/glide/load/resource/bitmap/TransformationUtils.java