switch to python3 for image_list
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function
|
# ~ from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@@ -408,7 +408,7 @@ def get_dims(filename):
|
|||||||
idargs=['identify','-format','%wx%h',filename+'[0]']
|
idargs=['identify','-format','%wx%h',filename+'[0]']
|
||||||
p=subprocess.Popen(idargs,stdout=subprocess.PIPE)
|
p=subprocess.Popen(idargs,stdout=subprocess.PIPE)
|
||||||
out, err = p.communicate()
|
out, err = p.communicate()
|
||||||
return (out.strip().split('x'))
|
return (out.decode('utf8').strip().split('x'))
|
||||||
|
|
||||||
def call_viewer(opts, files):
|
def call_viewer(opts, files):
|
||||||
""" Runs the viewer program, contains defaults """
|
""" Runs the viewer program, contains defaults """
|
||||||
@@ -545,8 +545,8 @@ def get_colors(filename):
|
|||||||
'-format','"%[fx:mean.r],%[fx:mean.g],%[fx:mean.b]"','info:-']
|
'-format','"%[fx:mean.r],%[fx:mean.g],%[fx:mean.b]"','info:-']
|
||||||
p=subprocess.Popen(mean_args,stdout=subprocess.PIPE,stdin=subprocess.PIPE)
|
p=subprocess.Popen(mean_args,stdout=subprocess.PIPE,stdin=subprocess.PIPE)
|
||||||
border, err = p.communicate(input=img)
|
border, err = p.communicate(input=img)
|
||||||
mean=[float(i) for i in mean.strip().strip('"').split(',')]
|
mean=[float(i) for i in mean.decode('utf8').strip().strip('"').split(',')]
|
||||||
border=[float(i) for i in border.strip().strip('"').split(',')]
|
border=[float(i) for i in border.decode('utf8').strip().strip('"').split(',')]
|
||||||
return (mean,border)
|
return (mean,border)
|
||||||
|
|
||||||
def get_color_diff(c1,c2):
|
def get_color_diff(c1,c2):
|
||||||
@@ -581,12 +581,13 @@ def append_fingerprints(opt):
|
|||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
def get_fingerprint(filename):
|
def get_fingerprint(filename):
|
||||||
small_args=['convert','-define','jpeg:size=256x256',filename+'[0]','-resize','160x160!',
|
print(filename)
|
||||||
|
small_args=['convert','-define','jpeg:size=256x256',filename+'[0]','-resize','160x160!', '-alpha', 'off',
|
||||||
'-colorspace','Gray','-blur','2x2','-normalize','-equalize','-resize','16x16','-depth','1','TXT:-']
|
'-colorspace','Gray','-blur','2x2','-normalize','-equalize','-resize','16x16','-depth','1','TXT:-']
|
||||||
p=subprocess.Popen(small_args,stdout=subprocess.PIPE)
|
p=subprocess.Popen(small_args,stdout=subprocess.PIPE)
|
||||||
img, err = p.communicate()
|
img, err = p.communicate()
|
||||||
values=''
|
values=''
|
||||||
for row in img.split('\n'):
|
for row in img.decode('utf8').split('\n'):
|
||||||
if row.find("gray(0)") > 0:
|
if row.find("gray(0)") > 0:
|
||||||
values += '0'
|
values += '0'
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user