Skip to content

Incorrect shape unpacking in edit_new_image_parameters #246

@cdebonnel

Description

@cdebonnel

Description

In the edit_new_image_parameters method of PluginBase, the shape tuple is unpacked as follows:

if shape is not None:
    newparam.width, newparam.height = shape

This code assumes that shape is a tuple of (width, height). However, DataLab uses a different convention for image shapes, where the tuple should be interpreted as (height, width). As a result, the current unpacking will lead to images with swapped dimensions for non-square images. This issue has not been noticed so far because the method is only used once in the code base for a square image.

Expected behavior

The method should unpack the shape tuple according to DataLab's convention, ensuring that images are created with the correct dimensions.

Suggested fix

if shape is not None:
    newparam.height , newparam.width = shape

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions