docs: private static URI createRaster(
              final Dimension targetSize, final RasterReference rasterReference,
              final Double rotation, final Color backgroundColor,
              final File workingDir) throws IOException {
          final File path = File.createTempFile("north-arrow-", ".png", workingDir);
  
          final BufferedImage newImage =
                  new BufferedImage(targetSize.width, targetSize.height, BufferedImage.TYPE_4BYTE_ABGR);
          final Graphics2D graphics2d = newImage.createGraphics();
          try {
              final BufferedImage originalImage = ImageIO.read(rasterReference.inputStream);
              if (originalImage == null) {
                  LOGGER.warn("Unable to load NorthArrow graphic: {}, it is not an image format that can be " +
                                      "decoded",
                              rasterReference.uri);
                  throw new IllegalArgumentException();
              }
  
              // set background color
              graphics2d.setColor(backgroundColor);
              graphics2d.fillRect(0, 0, targetSize.width, targetSize.height);
  
              // scale the original image to fit the new size
              int newWidth;
              int newHeight;
              if (originalImage.getWidth() > originalImage.getHeight()) {
                  newWidth = targetSize.width;
                  newHeight = Math.min(
                          targetSize.height,
                          (int) Math.ceil(newWidth / (originalImage.getWidth() /
                                  (double) originalImage.getHeight())));
              } else {
                  newHeight = targetSize.height;
                  newWidth = Math.min(
                          targetSize.width,
                          (int) Math.ceil(newHeight / (originalImage.getHeight() /
                                  (double) originalImage.getWidth())));
              }
  
              // position the original image in the center of the new
              int deltaX = (int) Math.floor((targetSize.width - newWidth) / 2.0);
              int deltaY = (int) Math.floor((targetSize.height - newHeight) / 2.0);
  
              if (!FloatingPointUtil.equals(rotation, 0.0)) {
                  final AffineTransform rotate = AffineTransform.getRotateInstance(
                          rotation, targetSize.width / 2.0, targetSize.height / 2.0);
                  graphics2d.setTransform(rotate);
              }
  
              graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                                          RenderingHints.VALUE_INTERPOLATION_BICUBIC);
              graphics2d.drawImage(originalImage, deltaX, deltaY, newWidth, newHeight, null);
  
              ImageUtils.writeImage(newImage, "png", path);
          } finally {
              graphics2d.dispose();
          }
          return path.toURI();
      }