The type 1
image you provided is grayscale and not completely black & white image. Yet the last threshold output image is black and white.
Based on your question my understanding is both of these should as classified as type 1
and the type 2
image example should classified as type 2.
If it was the case that type 1 was always black and white you could count the number of 0's and 1's in image and check if their sum equaled to total pixel count of image.
An option here is to classify two types of image without modifying images is to use the percentage of black and white pixels of image histogram.
Code
import cv2
import numpy as np
from matplotlib import pyplot as plt
from skimage import exposure
#img_path = r'hist_imgs/1.png'
#img_path = r'hist_imgs/2.png'
img_path = r'hist_imgs/3.png'
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
cv2.imshow('Image', img)
img_pixel_count = img.shape[0] * img.shape[1]
print(img.shape)
print(img_pixel_count)
h = np.array(exposure.histogram(img, nbins=256))
bw_count = h[0][0] + h[0][255]
other_count = img_pixel_count - bw_count
print('BW PIXEL COUNT: ', bw_count)
print('OTHER PIXEL COUNT: ', other_count)
bw_percentage = (bw_count * 100.0) / img_pixel_count
other_percentage = (other_count * 100.0) / img_pixel_count
print('BW PIXEL PERCENTAGE: ', bw_percentage)
print('OTHER PIXEL PERCENTAGE: ', other_percentage)
differentiate_threshold = 3.0
if other_percentage > differentiate_threshold:
print('TYPE 2: GRAYSCALE')
else:
print('TYPE 1: BLACK AND WHITE')
plt.hist(img.ravel(), 256, [0, 256])
plt.title('Histogram')
plt.show()
Input Images
Image 1:

Image 2:

Image 3:

Code Output
Image 1:
(154, 74)
11396
BW PIXEL COUNT: 11079
OTHER PIXEL COUNT: 317
BW PIXEL PERCENTAGE: 97.21832221832221
OTHER PIXEL PERCENTAGE: 2.781677781677782
TYPE 1: BLACK AND WHITE
Image 2:
(38, 79)
3002
BW PIXEL COUNT: 1543
OTHER PIXEL COUNT: 1459
BW PIXEL PERCENTAGE: 51.39906728847435
OTHER PIXEL PERCENTAGE: 48.60093271152565
TYPE 2: GRAYSCALE
Image 3:
(38, 79)
3002
BW PIXEL COUNT: 3002
OTHER PIXEL COUNT: 0
BW PIXEL PERCENTAGE: 100.0
OTHER PIXEL PERCENTAGE: 0.0
TYPE 1: BLACK AND WHITE