Hi!
If the original image is relatively large, it will be completely black, and the original image is displayed normally if it is small.
code show as below:
PngOptions pngOptions = new PngOptions();
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
pngOptions.setCompressionLevel(9);
int unitType = image.getUnitType();
rasterizationOptions.setUnitType(unitType);
rasterizationOptions.setPageSize(new SizeF(image.getWidth() / 20F, image.getHeight() / 20F));
List showLayerList = image.getLayers().getLayersNames();
showLayerList.remove(“xxx”);
rasterizationOptions.setLayers(showLayerList);
GraphicsOptions graphicsOptions = new GraphicsOptions();
graphicsOptions.setSmoothingMode(1);
rasterizationOptions.setGraphicsOptions(graphicsOptions);
rasterizationOptions.setDrawType(CadDrawTypeMode.UseObjectColor);
pngOptions.setVectorRasterizationOptions(rasterizationOptions);
image.save(targetPath, pngOptions);
result:
image.png (140.3 KB)
linux server:4核 16g
version:21.1
jvm: -Xms4096m -Xmx13000m -Xss1024K -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=1024m