Skip to content

Commit c0aa753

Browse files
author
Evgeniy Sidenko
committed
Release Aspose.Imaging for Python via .NET 25.6
1 parent 8e5f224 commit c0aa753

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# GROUP: TEST_FILE_FORMATS
2+
3+
import aspose.pycore as aspycore
4+
from aspose.imaging import Image
5+
from aspose.imaging.imageoptions import PngOptions, PngCompressionLevel
6+
import os
7+
8+
9+
# Initialization
10+
def get_data_root_dir_local():
11+
if 'BASE_DIR' in os.environ:
12+
return os.environ["BASE_DIR"]
13+
return "."
14+
15+
16+
if 'get_data_root_dir' not in dir():
17+
get_data_root_dir = get_data_root_dir_local
18+
19+
if 'get_output_dir' not in dir():
20+
get_output_dir = get_data_root_dir_local
21+
22+
# Example code:
23+
# The path to the documents directory.
24+
data_dir = os.path.join(get_data_root_dir(), 'png')
25+
26+
print("Running example PngCompressionLevelExample")
27+
28+
with Image.load(os.path.join(data_dir, "aspose_logo.png")) as image:
29+
for compression in range(11):
30+
output_file = os.path.join(get_output_dir(), f"compressionTest{compression}.png")
31+
out_options = PngOptions()
32+
out_options.png_compression_level = PngCompressionLevel(compression)
33+
image.save(output_file, out_options)
34+
35+
if 'SAVE_OUTPUT' not in os.environ:
36+
os.remove(output_file)
37+
38+
print("Finished example PngCompressionLevelExample")

0 commit comments

Comments
 (0)