I have this input`image1` which is 20x20 size and looks like this

```
00000000000000000000
00111000000000000000
01101100000001111000
11000110000001111110
11100000001100011110

```

and I need a function that will generate an output, say `image2` of 20x20 size, that will look like this

```
00000000000000000000
00111000000000000000
11011000000022220000
11000110000002222220
11000110000002222220
11100000003300022220

```

The difference is that the first appears to be a grey-scale image (only 0 and 1) while the desired output, based on the similar areas of the input image, will now contain 2,3 and so on.

So far I am looking for some of `pillow`'s build in functions that might suit me but I am not even sure if I am looking in the right direction. Could you please suggest a way to approach this?