-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.py
executable file
·42 lines (33 loc) · 1.54 KB
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from ImageGoNord import NordPaletteFile, GoNord
go_nord = GoNord()
"""image = go_nord.open_image("images/test-profile.jpg")
go_nord.convert_image(image, save_path='images/test.processed.jpg') """
# E.g. Avg algorithm and less colors
go_nord.enable_avg_algorithm()
# go_nord.reset_palette()
# go_nord.set_palette_lookup_path('./mypalette')
# go_nord.add_file_to_palette(NordPaletteFile.POLAR_NIGHT)
# go_nord.add_file_to_palette(NordPaletteFile.SNOW_STORM)
# go_nord.add_color_to_palette('#FF0000')
# go_nord.set_default_nord_palette()
image = go_nord.open_image("images/valley.jpg")
# go_nord.convert_image(image, save_path='images/test-valley-avg.jpg')
# E.g. Resized img no Avg algorithm and less colors
go_nord.disable_avg_algorithm()
# go_nord.reset_palette()
# go_nord.add_file_to_palette(NordPaletteFile.AURORA)
# go_nord.add_file_to_palette(NordPaletteFile.FROST)
image = go_nord.open_image("images/valley.jpg")
go_nord.convert_image(image, save_path="images/test-valley-ai.jpg", use_model=True)
exit()
# output_path = go_nord.convert_video('videos/SampleVideo_720x480.mp4', 'custom_palette', save_path='videos/SampleVideo_converted.mp4')
image = go_nord.open_image("images/test.jpg")
resized_img = go_nord.resize_image(image)
go_nord.convert_image(resized_img, save_path='images/test.resized.jpg')
# E.g. Quantize
image = go_nord.open_image("images/test.jpg")
go_nord.reset_palette()
go_nord.set_default_nord_palette()
quantize_image = go_nord.quantize_image(image, save_path='images/test.quantize.jpg')
# To base64
go_nord.image_to_base64(quantize_image, 'jpeg')