kopia lustrzana https://github.com/dnet/pySSTV
handle progress line values near gray (fixes gh-4)
rodzic
e9db1cf9a0
commit
3d68f7cc5b
|
@ -105,9 +105,9 @@ class ProgressCanvas(Canvas):
|
|||
pixels = image.load()
|
||||
RED, GREEN, BLUE = range(3)
|
||||
self.colors = ['#{0:02x}{1:02x}{2:02x}'.format(
|
||||
255 - sum(pixels[x, y][RED] for x in xrange(width)) / width,
|
||||
255 - sum(pixels[x, y][GREEN] for x in xrange(width)) / width,
|
||||
255 - sum(pixels[x, y][BLUE] for x in xrange(width)) / width)
|
||||
contrast(sum(pixels[x, y][RED] for x in xrange(width)) / width),
|
||||
contrast(sum(pixels[x, y][GREEN] for x in xrange(width)) / width),
|
||||
contrast(sum(pixels[x, y][BLUE] for x in xrange(width)) / width))
|
||||
for y in xrange(height)]
|
||||
if height / float(width) > 1.5:
|
||||
width *= 2
|
||||
|
@ -131,6 +131,12 @@ class ProgressCanvas(Canvas):
|
|||
self.create_line(0, line, image.width(), line, fill=fill)
|
||||
|
||||
|
||||
def contrast(value):
|
||||
if 80 < value < 160:
|
||||
return value + (80 if value < 120 else -80)
|
||||
else:
|
||||
return 255 - value
|
||||
|
||||
def transmit_current_image(image, drawable, mode, vox, fskid):
|
||||
sstv = MODULE_MAP[mode]
|
||||
pil_img = match_image_with_sstv_mode(image_gimp_to_pil(image), sstv)
|
||||
|
|
Ładowanie…
Reference in New Issue