Text in random image encoder: is it flawed?
This is flawed:

Cracking: The format leaks information on how often specific characters occur.
For instance, if input message contains 6 o letters, there is likely much more 111 values than the most other values present. Such a small biases are sufficient for cryptoanalysis to break the message in many cases.

Also, random.randint does not return random number suitable for cryptographic purposes, it means the scheme can be possibly broken. (See https://docs.python.org/2/library/random.html for guidance, which tells the function shall not be used for cryptographic purposes). In current versions of Python, the generator is Mersenne Twister, which is easy to reverse (break). (See http://b10l.com/reversing-the-mersenne-twister-rng-temper-function/). Long story short, an attacker can easily use the produced image to find the original seed of the random number generator and thus, be able to generate the key. 

The system is not very space efficient: there is large overhead, the produced message is much larger than the input. (The technique primarily sounds more like steganography instead of cryptography.) Also, the key is longer than the message, and variable length.