79651347

Date: 2025-06-03 13:43:24
Score: 0.5
Natty:
Report link

You have to choose a resampling method with nearest-neighbor interpolation. In pillow use something like

w, h         = bw_image.size
scale_factor = 16
img_scaled   = bw_image.resize((w * scale_factor, h * scale_factor), resample=Image.NEAREST)

where scale_factor is your integer scaling factor. Result:

Scaled with nearest neighbor

When using matplotlib you can also only scale for display, i.e.

import matplotlib.pyplot as plt
plt.imshow(bw_data, cmap='gray', interpolation='nearest')
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: André