I admit, at some point I did that too, it only takes ~15 lines of Python. Until I realised it becomes a lot bigger than the equivalent image file.
However I'm still a fan of proper 'X in pure CSS' where the thing is built with circles and rectangles and shadows, etc... to make the shape which actually ends up being much much smaller than the equivalent image and renders a lot faster.
Things like iPhone in pure css, or Macbook in pure css, etc...