Skip to content

Revaluate if backend should require tiffs to be in RGB/RGBA format before converting to PNG #81

@yousefmoazzam

Description

@yousefmoazzam

There's only a need for grayscale images in the frontend, so this conversion to RGB/RGBA is possibly unnecessary:

# Convert to RGB if necessary (TIFF might be in different modes)
if img.mode not in ('RGB', 'RGBA'):
if img.mode == 'I;16':
array = np.array(img)
normalized = (array.astype(np.uint16) - array.min()) * 255.0 / (array.max() - array.min())
img = Image.fromarray(normalized.astype(np.uint8))
img = img.convert('RGB')

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