How to add noise (dithering) at background only?

I am trying to train a model with some noisy images having dithering.

What I have :

  1. clean pdfs with white background
  2. coloured pdfs(RGB) and grayscale pdfs (with 3 channels, RGB)

What I want:

  1. convert only white background (not text) into gray background, if possible only half page should be converted

  2. Add dithering to the gray background without loosing the text

what I tried:

import os

from PIL import Image
from numpy import asarray


ORIGIN_PATH = "/home/dithering/temp/"
DESTIN_PATH = "/home/dithering/temp_try/"
"""for filename in os.listdir(ORIGIN_PATH):
    img = Image.open(ORIGIN_PATH + filename).convert("L")
    rbg_grayscale_img = img.convert("RGB")
    rbg_grayscale_img.save(DESTIN_PATH + filename)"""


for filename in os.listdir(ORIGIN_PATH):

    img = Image.open(ORIGIN_PATH + filename).convert("L", dither=Image.Dither.FLOYDSTEINBERG)

    # convert image to nparray
    numpydata = asarray(img)
    numpydata[numpydata > 250] = 128

    # data
    print(numpydata)

    # convert array to image
    final_image = Image.fromarray(numpydata)

    # img show
    final_image.show()

    # img save
    final_image.save(DESTIN_PATH + filename)

I expect something like this, enter image description here

Any help would be appreciated, thanks in advance! @ptrblck