added convert to binary image function