Modifying sizes and thickness of letters to "embed" an image in text
...give the text an appearance of an image when looked from far away.


The technique you are looking for is called "Halftoning".

It works with all sorts of tiles as long as you can get an indication of their "grayscale value" or, in the case of coloured images, the "grayscale value" for each colour (RGB).

Consider for example these two letters in a very elementary and rather retro "dot matrix" representation. Grey values represent background, White values represent foreground.



The amount of "dots" that each letter turns on is 10 and 5 respectively. Therefore, "A" would be brighter than "I" if they were to be used as pixels.

If you count how many "dots" each character (in a particular alphabet of characters you may have available) turns on and call that "brightness", you can then order the letters from darkest to brightest and create a correspondence between pixel value and letter that has to be typed.

Similarly, you can do this for any coloured image and create a colour palette (a set of RGB values, potentially ordered by their brightness).

This is the simple version of half-toning.

There is a tonne of software that do this (or slight variants) already, such as caca and hiptext  (or even img2txt).

The next step is to apply dithering which is a way of reducing the impact of the quantisation of the image from fine grain pixels to the tiles or maintain a list of alternative tiles for the same "grey value" to avoid repetition. Some of the tools above already cover these.

Beyond this simple method there are variants that given a set of tiles they will also try to match the "shape" of the tile to the shape of the image patch they are placed over. The output of those programs is really impressive. Unfortunately, I could not find the one I had in mind but there seems to be this one and one of the papers describing the technique is this one

Hope this helps.