Skip to content

Load image with original aspect ratio and sorter one image to multiple categories #1

@ahbon123

Description

@ahbon123

Hello Nestak2:

Thanks for sharing this project which is quite useful. Anyway after using locally this project, I would like to make two proposals for you:

First, I think it would be better if we can load images with original aspect ratio.
This is my code, if you want, you can use:

    @staticmethod
    def _load_image(path):
        """
        Loads and resizes an image from a given path using the Pillow library
        :param path: Path to image
        :param size: Size of display image
        :return: Resized image
        """
        max_height = 700 
        img = Image.open(path)
        s = img.size
        ratio = max_height / s[1]
        image = img.resize((int(s[0]*ratio), int(s[1]*ratio)), Image.ANTIALIAS)
        return image

Second, I hope to realize a function which can sorter or copy one image into multiple folders, could you please make this function and update on Github? Thanks a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions