added functionality to ignore white pixels.