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 JPG, HTML, lan akeh format dokumen liyane nggunakake Python.
Kudu ngowahi JPG gambar menyang HTML file programmatically? Kanthi Aspose.Words for Python via .NET pangembang bisa gampang ngowahi JPG dadi HTML format mung sawetara baris Python kode.
Pemrosesan gambar modern Python API nggawe HTML saka JPG gambar kanthi kacepetan dhuwur. Nguji kualitas JPG nganti HTML langsung ing browser. Python kuat ngidini ngowahi JPG gambar akeh format dokumen populer.
Conto ing ngisor iki nuduhake carane ngowahi JPG dadi HTML ing Python.
Tindakake langkah sing gampang kanggo nguripake JPG gambar menyang HTML format. Waca JPG saka drive lokal, banjur simpen minangka HTML, nemtokake format dokumen sing dibutuhake dening extension HTML Kanggo loro JPG maca lan HTML nulis sampeyan bisa nggunakake jeneng berkas qualified. Konten output HTML bakal padha karo gambar asli JPG.
pip install aspose-words
Nyalin
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.insert_image("Input.jpg")
doc.save("Output.html")
import aspose.words as aw
doc = aw.Document("Input.jpg")
doc.save("Output.html")
import aspose.words as aw
doc = aw.Document(Input.jpg)
for page in range(0, doc.page_count):
extractedPage = doc.extract_pages(page, 1)
extractedPage.save(f"Output_{page + 1}.html")
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.insert_image("Input.jpg")
doc.save("Output.html")
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
shape = builder.insert_image("Input.jpg")
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 JPG menyang akeh format file liyane: