Replacing pixel values with percentages