你好!
原图比较大是就会全黑,原图小显示正常
代码如下:
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);
结果:
image.png (129.6 KB)
linux环境:4核 16g
版本:21.1
jvm: -Xms4096m -Xmx13000m -Xss1024K -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=1024m