2013-11-26 17 views
0

Python Wand打開一個img文件爲blob,md5不正確。Python Wand打開一個img文件爲blob,md5不正確。這是魔杖的錯誤嗎?

with Image(filename=picture) as img: 
    blob = img.make_blob() 
    print 'blob md5', hashlib.md5(blob).hexdigest() 
with open(picture, 'rb') as img: 
    content = img.read() 
    print 'content md5', hashlib.md5(content).hexdigest() 
+0

有兩種方法可以將img打開爲二進制,但md5不同。任何機構都可以分享? – user3034768

回答

1

.make_blob()方法不會將完全相同的二進制寫入其源文件。如果你想要像素而不是文件表示使用.signature屬性。