code: public static String createMarkerImage(String uri, String type) {
          Logger.getLogger(MarkerImageFactory.class.getName()).log(Level.FINEST, "createMarkerImage using: {0}", uri);
          
          String dataURI = null;
          
          if (uri.startsWith("file:")) {
              return createMarkerImageFromFile(uri, type);
          }
          
          URL myURL = MarkerImageFactory.class.getResource(uri);
          
          if (myURL != null) {
              String myURI = myURL.toExternalForm();
              Image img = new Image(myURI);
              
              String imageMimeType = "image/" + type;
              
              try {
                  dataURI = "data:" + imageMimeType + ";base64,(" + 
                          javax.xml.bind.DatatypeConverter.printBase64Binary(getImageBytes(SwingFXUtils.fromFXImage(img, null), type)) + ")";
              } catch (IOException ioe) {
                  Logger.getLogger(MarkerImageFactory.class.getName()).log(Level.WARNING, "Cannot create marker image", ioe);
                  dataURI = null;
              }
          }
          
          return dataURI;
          
      }
docs: Takes a URI for an image contained within an application jar file and
  converts it into a data URI for use in a MarkerOptions object.
  <p>
  Usage:
  <p>
  markerOptions.icon(MarkerImageFactory.createMarkerImage("/path/to/my/image.jpg", "jpg"));
  <p>
  Currently tested to work with "jpg" and "png" files.
  
  @param uri
  @param type
  @return