protected BufferedImage getImage(Object imageSource) {
    if (imageSource instanceof String) {
      String path = (String) imageSource;

      Object streamOrException = WWIO.getFileOrResourceAsStream(path, this.getClass());
      if (streamOrException == null || streamOrException instanceof Exception) {
        Logging.logger()
            .log(
                java.util.logging.Level.SEVERE,
                "generic.ExceptionAttemptingToReadImageFile",
                streamOrException != null ? streamOrException : path);
        return null;
      }

      try {
        return ImageIO.read((InputStream) streamOrException);
      } catch (Exception e) {
        Logging.logger()
            .log(
                java.util.logging.Level.SEVERE, "generic.ExceptionAttemptingToReadImageFile", path);
        return null;
      }
    } else if (imageSource instanceof BufferedImage) {
      return (BufferedImage) imageSource;
    }

    return null;
  }