Gambar STL
Contents
[
Hide
]Ekspor Format STL ke PNG
Aspose.CAD untuk Javascript di Angular memungkinkan pengembang untuk mengekspor file STL ke format PNG. Pendekatan konversi STL ke PNG bekerja sebagai berikut:
- Muat file gambar STL menggunakan metode Image.load.
- Panggil Image.save sambil melewatkan objek PngOptions sebagai parameter kedua.
Contoh Kode
Kode di bawah ini menunjukkan cara mencapai tujuan yang sama menggunakan Aspose.CAD untuk 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.stl | |
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' }); | |
}); | |
} |