Skip to content

transforms.functional.rotate doesn't work for grayscale images #1776

Closed
@qfgaohao

Description

@qfgaohao

When applying the function on grayscale images, it throws the following error:

packages/torchvision/transforms/functional.py", line 729, in rotate
return img.rotate(angle, resample, expand, center, fillcolor=fill)
File "/home/xxx/local/anaconda3/envs/th/lib/python3.7/site-packages/PIL/Image.py", line 2023, in rotate
return self.transform((w, h), AFFINE, matrix, resample, fillcolor=fillcolor)
File "/home/xxx/local/anaconda3/envs/th/lib/python3.7/site-packages/PIL/Image.py", line 2337, in transform
im = new(self.mode, size, fillcolor)
File "/home/xxx/local/anaconda3/envs/th/lib/python3.7/site-packages/PIL/Image.py", line 2544, in new
return im._new(core.fill(mode, size, color))
TypeError: function takes exactly 1 argument (3 given)

It is related to the pull request #1280

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