۳D طراحیها
Contents
[
Hide
]صادرات فرمت ۳DS به PNG
Aspose.CAD برای جاوا اسکریپت در انگولار به توسعهدهندگان اجازه میدهد تا فایل ۳DS را به فرمت PNG صادر کنند. رویکرد تبدیل ۳DS به PNG به صورت زیر عمل میکند:
- بارگذاری فایل طراحی ۳DS با استفاده از روش Image.load.
- فراخوانی Image.save و ارسال یک شی از PngOptions به عنوان پارامتر دوم.
نمونه کد
کد زیر نشان میدهد چگونه میتوان همان هدف را با استفاده از Aspose.CAD برای جاوا اسکریپت به دست آورد.
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.3ds | |
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' }); | |
}); | |
} |