improved pixel conversion