code: public static Pair<Integer, Integer> getImageDimensions(@NonNull final Context context,
                                                              @DrawableRes final int resourceId)
              throws IOException {
          Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
          BitmapFactory.Options options = new BitmapFactory.Options();
          options.inJustDecodeBounds = true;
          BitmapFactory.decodeResource(context.getResources(), resourceId, options);
          int width = options.outWidth;
          int height = options.outHeight;
  
          if (width == -1 || height == -1) {
              throw new IOException("Failed to decode image resource with id " + resourceId);
          }
  
          return Pair.create(width, height);
      }
docs: Returns the width and height of a specific image resource.
  
  @param context
  The context, which should be used, as an instance of the class {@link Context}. The
  context may not be null
  @param resourceId
  The resource id of the image resource, whose width and height should be returned, as
  an {@link Integer} value. The resource id must correspond to a valid drawable
  resource
  @return A pair, which contains the width and height of the given image resource, as an
  instance of the class Pair
  @throws IOException
  The exception, which is thrown, if an error occurs while decoding the image resource