Warn that tobytes is not for compressed image data by masklinn · Pull Request #1470 · python-pillow/Pillow

Every time I try to get in-memory PNG or JPEG data I tend to spend half an hour fighting with tobytes until I remember it is not going to work and I'm supposed to use im.save(fp, format='png').
#985 makes me think I'm not alone, and a clear warning in the documentation can only help others (and future-me).

I don't actually know what tobytes is for, so I went with something along the lines of @wiredfool's comment in #985, they note that it's

only used for a couple very close to raw formats