I'm trying to work out a method for dynamically generating image files with PIL/Pillow that are a certain file size in order to better exercise certain code paths in my unit tests.
For example, I have some image validation code that limits the file size to 100kb. I'd like to generate an image dynamically that is 150kb to ensure that the validation works. It needs to be a valid image and within given dimensions (ie 400x600).
Any thoughts on how to add sufficient "complexity" to an image canvas for testing?