BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) image.getGraphics();
g.setColor(Color.WHITE);
g.fillRect(0, 0, width, height);
MapContent mapContent = new MapContent();
MapViewport viewport = mapContent.getViewport();
viewport.setBounds(new ReferencedEnvelope(mapArea, DefaultGeographicCRS.WGS84));
viewport.setScreenArea(new Rectangle(width, height));
mapContent.addLayer(new FeatureLayer(featureSource, style));
StreamingRenderer renderer = new StreamingRenderer();
renderer.setRendererHints(renderingHints);
renderer.setMapContent(mapContent);
renderer.paint(g, viewport.getScreenArea(), viewport.getBounds());