Skip to content

Image.tobytes Call Format for Non-raw Encoders #985

@unwitting

Description

@unwitting

Hi all,

Having a bit of a problem with Image.tobytes with non-"raw" encoders:

img.tobytes()

and the explicit:

img.tobytes('raw')

Both work fine, but something like:

img.tobytes('gif')

gives me the following error:

File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 650, in tobytes
    e = _getencoder(self.mode, encoder_name, args)
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 430, in _getencoder
    return encoder(mode, *args + extra)
TypeError: function takes at least 2 arguments (1 given)

Any guidance here? Honestly can't work out if I'm being the world's biggest noob or if something's amiss here!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions