change algorithm write image