switch to python3 for image_list
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
#!/usr/bin/env python3
|
||||
# ~ from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
@@ -408,7 +408,7 @@ def get_dims(filename):
|
||||
idargs=['identify','-format','%wx%h',filename+'[0]']
|
||||
p=subprocess.Popen(idargs,stdout=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
return (out.strip().split('x'))
|
||||
return (out.decode('utf8').strip().split('x'))
|
||||
|
||||
def call_viewer(opts, files):
|
||||
""" 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:-']
|
||||
p=subprocess.Popen(mean_args,stdout=subprocess.PIPE,stdin=subprocess.PIPE)
|
||||
border, err = p.communicate(input=img)
|
||||
mean=[float(i) for i in mean.strip().strip('"').split(',')]
|
||||
border=[float(i) for i in border.strip().strip('"').split(',')]
|
||||
mean=[float(i) for i in mean.decode('utf8').strip().strip('"').split(',')]
|
||||
border=[float(i) for i in border.decode('utf8').strip().strip('"').split(',')]
|
||||
return (mean,border)
|
||||
|
||||
def get_color_diff(c1,c2):
|
||||
@@ -581,12 +581,13 @@ def append_fingerprints(opt):
|
||||
conn.commit()
|
||||
|
||||
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:-']
|
||||
p=subprocess.Popen(small_args,stdout=subprocess.PIPE)
|
||||
img, err = p.communicate()
|
||||
values=''
|
||||
for row in img.split('\n'):
|
||||
for row in img.decode('utf8').split('\n'):
|
||||
if row.find("gray(0)") > 0:
|
||||
values += '0'
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user