Image.tobytes()
Returns the image as a byte object
Syntax: Image.tobytes ( encoder_name = ’raw’, * args)
Parameters:
encoder_name - What encoder to use. The default is to use the standard “raw” encoder.
args - Extra arguments to the encoder.Returns: A bytes object .
Image used:
|
Exit:
PIL.JpegImagePlugin.JpegImageFile image mode = RGB size = 259x194 at 0x2D39DED2BE0
Another example: the same image is used here with the encoder name changed to hex.
Image used:
|
Exit :
PIL.JpegImagePlugin.JpegImageFile image mode = RGB size = 259x194 at 0x27845B91BE0