Create set of random JPGs

Posted by Kylar on Stack Overflow See other posts from Stack Overflow or by Kylar
Published on 2012-06-05T16:23:18Z Indexed on 2012/06/05 16:40 UTC
Read the original article Hit count: 141

Filed under:
|
|

Here's the scenario, I want to create a set of random, small jpg's - anywhere between 50 bytes and 8k in size - the actual visual content of the jpeg is irrelevant as long as they're valid. I need to generate a thousand or so, and they all have to be unique - even if they're only different by a single pixel. Can I just write a jpeg header/footer and some random bytes in there? I'm not able to use existing photos or sets of photos from the web.

The second issue is that the set of images has to be different for each run of the program.

I'd prefer to do this in python, as the wrapping scripts are in Python.

I've looked for python code to generate jpg's from scratch, and didn't find anything, so pointers to libraries are just as good.

© Stack Overflow or respective owner

Related posts about python

Related posts about jpeg