Remove astype(...) as img_as_ubyte already does that.