fix bug; imageEncodeData is not big enough to contain the code.