Save Tensor as 1D PNG image

Hello,

I want to save a Tensor: torch.Size([480, 854]) as a PNG image which has one dimensional depth. I used torchvision.utils.save_image but it converts this tensor to a [3,480,854] image.
Please let me know if you have any suggestions.

Thanks.

save_image uses internally PIL.Image.save, with an optional format argument as seen here.
You could potentially pass the desired format using these PIL format docs.