We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

DWG to PNG: Original image is too large and completely black

你好!
原图比较大是就会全黑,原图小显示正常
代码如下:

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

@komorebi

我想你也已经在另一个帖子中分享了这个问题。 我在那里分享了我的回应。 请遵循以下线程。