Peter, Thanks for your test in details. Because I'm an newbie in Python and I can not conform whether it is an bug. Here I attach my code include my emample.bmp as link below. https://hotfile.com/dl/204795514/62fed41/BMPTool.zip.html