File: utilities-examples.py

package info (click to toggle)
trollimage 1.28.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,188 kB
  • sloc: python: 7,074; makefile: 114
file content (18 lines) | stat: -rw-r--r-- 609 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Example showing importing colormaps from on-disk files."""
from trollimage import utilities as tu

#  Examples: importing colormaps
filename = 'setvak.rgb'
my_cmap = tu.cmap_from_text(filename)
print(my_cmap.colors)
my_cmap_norm = tu.cmap_from_text(filename, norm=True)
print(my_cmap_norm.colors)
my_cmap_transp = tu.cmap_from_text(filename, norm=True, transparency=True)
print(my_cmap_transp.colors)
filename = 'hrv.rgb'
my_cmap_hex = tu.cmap_from_text(filename, hex=True)
print(my_cmap_hex.colors)

#  Example: converting PIL to trollimage.Image
image = "pifn.png"
timage = tu.pilimage2trollimage(image)