Skip to content

torchvision.transforms.functional.adjust_hue does not respect alpha channel #3219

Open
@jamespltan

Description

@jamespltan

🐛 Bug

when working with RGBA images, the adjust_hue function does not seem to respect the alpha channel and imposes a max_value of 255 after the transform. Taking a quick look at the source code, it seems that the image is immediately converted to HSV without retaining the alpha channel. It should be a quick fix to retain the alpha channel and include it when merging back into RGBA.

To Reproduce

Steps to reproduce the behavior:

img = Image.open('xyz.png')
img_ = adjust_hue(img, 0.1)
print(np.array(img.split()[-1]).mean())
print(np.array(img_.split()[-1]).mean())

cc @vfdev-5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions