Skip to content

Commit

Permalink
feat: P mode in image
Browse files Browse the repository at this point in the history
  • Loading branch information
piercus committed Jan 15, 2024
1 parent 0c73c93 commit a05aaee
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/refiners/fluxion/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ def image_to_tensor(image: Image.Image, device: Device | str | None = None, dtyp
Values are clamped to the range `[0, 1]`.
"""
if image.mode == 'P':
image = image.convert('RGB')

image_tensor = torch.tensor(array(image).astype(float32) / 255.0, device=device, dtype=dtype)

match image.mode:
Expand Down

0 comments on commit a05aaee

Please sign in to comment.