Fix image pixel calculation