We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 541229b commit fe960a6Copy full SHA for fe960a6
1 file changed
JPEG to PNG/script.py
@@ -0,0 +1,24 @@
1
+import spire.xls as xls
2
+
3
+def convert_jpeg_to_png(input_file_path, output_file_path):
4
+ workbook = xls.Workbook()
5
+ workbook.LoadFromFile(input_file_path)
6
7
+ # Convert JPEG to PNG by calling Workbook.save() method.
8
+ workbook.save(output_file_path, Format=xls.ExcelFormat.PNG)
9
10
+ # Get the conversion result.
11
+ conversion_result = workbook.SaveResult
12
13
+ return conversion_result
14
15
+if __name__ == "__main__":
16
+ input_file_path = "input.jpg"
17
+ output_file_path = "output.png"
18
19
+ conversion_result = convert_jpeg_to_png(input_file_path, output_file_path)
20
21
+ if conversion_result:
22
+ print("The JPEG file was successfully converted to PNG.")
23
+ else:
24
+ print("An error occurred while converting the JPEG file to PNG.")
0 commit comments