Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got some problem while running build_database.py using Windows #5

Open
12ycli opened this issue Aug 31, 2018 · 1 comment
Open

got some problem while running build_database.py using Windows #5

12ycli opened this issue Aug 31, 2018 · 1 comment

Comments

@12ycli
Copy link

12ycli commented Aug 31, 2018

As tutorial says,for getting down-sized pics we should run build_database.py.However,a small problem occurred because Linux and Windows use different file directory separation mark.Function below should change filename.split('/')[-1])) into filename.split('\\')[-1])) while using Windows.

def resize_and_save(filename, output_dir, size=SIZE):
    """Resize the image contained in `filename` and save it to the `output_dir`"""
    image = Image.open(filename)
    # Use bilinear interpolation instead of the default "nearest neighbor" method
    image = image.resize((size, size), Image.BILINEAR)
    image.save(os.path.join(output_dir, filename.split('/')[-1]))
@omoindrot
Copy link
Contributor

A better way would be to use os.path.basename instead of filename.split('/')[-1].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants