File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Examples/src/modifyingandconvertingimages Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ # GROUP: MODIFYING_AND_CONVERTING_IMAGES
2+
3+ from aspose .pycore import as_of
4+ from aspose .imaging import Image , RasterImage
5+ import os
6+
7+
8+ # Initialization
9+ def get_data_root_dir_local ():
10+ if 'BASE_DIR' in os .environ :
11+ return os .environ ["BASE_DIR" ]
12+ return "."
13+
14+
15+ if 'get_data_root_dir' not in dir ():
16+ get_data_root_dir = get_data_root_dir_local
17+
18+ if 'get_output_dir' not in dir ():
19+ get_output_dir = get_data_root_dir_local
20+
21+ # Example code:
22+ # The path to the documents directory.
23+ data_dir = os .path .join (get_data_root_dir (), 'ModifyingAndConvertingImages' )
24+ out_file = os .path .join (get_output_dir (), "result.png" )
25+ out_file2 = os .path .join (get_output_dir (), "result2.png" )
26+ print ("Running example AutoAdjustImageBrightness" )
27+
28+ # Load an existing JPG image
29+ with as_of (Image .load (os .path .join (data_dir , "sample.png" )), RasterImage ) as image :
30+ image .normalize_histogram ();
31+ image .save (out_file );
32+ image .adjust_contrast (30 );
33+ image .save (out_file2 );
34+
35+ if 'SAVE_OUTPUT' not in os .environ :
36+ os .remove (out_file )
37+ os .remove (out_file2 )
38+
39+ print ("Finished example AutoAdjustImageBrightness" )
You can’t perform that action at this time.
0 commit comments