การส่งออก 3DS รูปแบบไปยัง PNG
Contents
[
Hide
]การส่งออก 3DS รูปแบบไปยัง PNG
Aspose.CAD สำหรับ Javascript ใน Angular ช่วยให้นักพัฒนาสามารถส่งออกไฟล์ 3DS ไปยังรูปแบบ PNG ได้ วิธีการแปลง 3DS เป็น PNG ทำงานดังนี้:
- โหลดไฟล์วาดภาพ 3DS โดยใช้วิธี Image.load
- เรียกใช้ Image.save โดยส่งวัตถุของ PngOptions เป็นพารามิเตอร์ที่สอง
ตัวอย่างโค้ด
โค้ดด้านล่างแสดงให้เห็นวิธีการบรรลุวัตถุประสงค์เดียวกันโดยใช้ Aspose.CAD สำหรับ 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.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' }); | |
}); | |
} |