improve image pixel manipulation