Gunakake API konversi dokumen kanggo ngembangake piranti lunak independen platform tingkat dhuwur ing Python. Iki minangka solusi piranti lunak profesional lengkap kanggo ngimpor lan ngekspor gambar, HTML, lan akeh format dokumen liyane nggunakake Python.
Kudu ngowahi gambar menyang HTML file programmatically? Kanthi Aspose.Words for Python via .NET pangembang bisa gampang ngowahi gambar menyang HTML mung sawetara baris Python kode.
Pemrosesan gambar modern Python API nggawe HTML saka gambar kanthi kacepetan dhuwur. Tes kualitas gambar kanggo HTML langsung ing browser. Python kuat ngidini ngowahi gambar dadi akeh format dokumen populer.
Conto ing ngisor iki nuduhake carane ngowahi gambar dadi HTML ing Python.
Tindakake langkah-langkah gampang kanggo ngowahi gambar dadi HTML format Waca gambar saka drive lokal, banjur simpen minangka HTML format dokumen sing dibutuhake dening extension HTML Kanggo maca gambar lan HTML sampeyan bisa nggunakake jeneng file sing mumpuni. Output HTML isi bakal padha karo gambar sumber.
pip install aspose-words
Nyalin
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.insert_image("Input.png")
doc.save("Output.html")
import aspose.words as aw
doc = aw.Document("Input.png")
doc.save("Output.html")
import aspose.words as aw
doc = aw.Document("Input.png")
save_options = aw.saving.ImageSaveOptions(aw.SaveFormat.html)
for page in range(doc.page_count):
save_options.page_set = aw.saving.PageSet(page)
doc.save(f"Output_{page + 1}.html", save_options)
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.insert_image("Input.png")
doc.save("Output.html")
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
shape = builder.insert_image("Input.png")
shape.get_shape_renderer().save("Output.html", aw.saving.ImageSaveOptions(aw.SaveFormat.html))
Kita dadi tuan rumah paket Python ing repositori PyPi. Mangga tindakake langkah-langkah dening-instruksi carane nginstal "Aspose.Words for Python via .NET" kanggo lingkungan pangembang.
Paket iki kompatibel karo Python ≥3.5 lan <3.12. Yen sampeyan ngembangake piranti lunak kanggo Linux, deleng syarat tambahan kanggo gcc lan libpython ing Dokumentasi Produk.
Sampeyan bisa ngowahi gambar menyang akeh format file liyane: