image-sorter2 icon indicating copy to clipboard operation
image-sorter2 copied to clipboard

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

Open ahbon123 opened this issue 6 years ago • 5 comments

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.

ahbon123 avatar Aug 03 '19 14:08 ahbon123

Hi ahbon123, I am happy to read the code is useful for you! I will implement your presented function def _load_image(path) in the next days, as soon as I have the time for that.

Regarding your second suggestion: I must admit that my skills with tkinter are really poor, I just changed by trial and error the original project image-sorter by Christian Baumgartner. If I have time in 2 or 3 months maybe I will look into making the change you suggest, but else I encourage you to make any adjustments you like and I can then add you as a contributor and we will just include your version into the repository :) Or you can also publish the changes in a new repository on your own.

Sorry that I can't help out more for now, have fun with the code!

Nestak2 avatar Aug 03 '19 14:08 Nestak2

I'll try, if I have any progress, I'll let you know. Thanks anyway.

ahbon123 avatar Aug 03 '19 15:08 ahbon123

It looks like @aman17ashray (thanks!) has included a resizing option as a boolean variable at the beginning of the script. I'll keep the issue open, though, since we don't have yet an option to include an image into multiple categories.

Nestak2 avatar Mar 27 '20 17:03 Nestak2

Hi, Can you please elaborate what you meant by

an option to include an image into multiple categories.

ghost avatar Mar 27 '20 18:03 ghost

@aman17ashray In the post by abhon123 above he asks for

a function which can sorter or copy one image into multiple folders

Nestak2 avatar Mar 27 '20 18:03 Nestak2