使用 OBJ 文件格式
Contents
[
Hide
]Aspose.CAD 现在支持 OBJ 文件格式。OBJ 文件格式是一种 3D 几何图形,包含纹理图、3D 坐标、多边形面和其他对象信息。
将 OBJ 格式导出为 PNG
在 Angular 中,Aspose.CAD for Javascript 允许开发人员将 OBJ 文件导出为 PNG 格式。 OBJ 到 PNG 的转换方法如下:
- 使用 Image.load 方法加载 OBJ 绘图文件。
- 在调用 Image.save 时,将 PngOptions 的对象作为第二个参数传递。
示例代码
下面的代码显示了使用 Aspose.CAD for JavaScript 达成相同目标的方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async onFileSelected(event) { | |
const file: File = event.target.files[0]; | |
file.arrayBuffer().then(async buff => { | |
let x = new Uint8Array(buff); | |
this.imgFile = await Image.load(x); | |
var exportedFile = await Image.save(this.imgFile, new PngOptions()); | |
var blob = new Blob([exportedFile], { type: 'application/octet-stream' }); | |
}); | |
} |