LINUX.ORG.RU

История изменений

Исправление ados, (текущая версия) :

Пока решаю задачу так:


from PIL import Image
import sys

img = Image.open(sys.argv[1], 'r')

l = img.tag.items()[4][1][0].splitlines()
ix = l.index(u'AP_PIXEL_SIZE')

xstring = l[ix+1] # typical value is u'Pixel Size = 2.0 nm'
xstring2 = xstring[13:] # cut off 'Pixel Size = '

x, u = xstring2.split()
x = float(x)

print "Size of pixel is {} {}".format(x, u)

Исходная версия ados, :

Пока решаю задачу так:


from PIL import Image
import sys

img = Image.open(sys.argv[1], 'r')

l = img.tag.items()[4][1][0].splitlines()
ix = l.index(u'AP_PIXEL_SIZE')

xstring = l[ix+1] # typical value is u'Pixel Size = 2.0 nm'
xstring2 = xstring[13:] # cut off 'Pixel Size = '

x, u = xstring2.split()
x = float(x)

print "Size of pixel is {} {}".format(x, u)