How can I convert the numpy array got from binarize_image function and save that image. I am doing pre-processing on images. After converting the image into grayscale, I had used the turned them into binary image.
def binarize_image(img):
ret1, th1 = cv2.threshold(img, BINARY_THREHOLD, 255, cv2.THRESH_BINARY)
return th1 # numpy.ndarray
Here i am saving the image
img.format = 'jpeg'
img_buffer = np.asarray(bytearray(img.make_blob()), dtype=np.uint8)
img = binarize_image(img_buffer)
# ..... Code to convert the ndarray back to Wand Image format .......
img.save(filename=os.path.join(pdf_folder,image_folder,outputFileName))