Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

How can I apply this function to multiple images? #39

Open
balaganeshmohan opened this issue Jul 12, 2020 · 2 comments
Open

How can I apply this function to multiple images? #39

balaganeshmohan opened this issue Jul 12, 2020 · 2 comments

Comments

@balaganeshmohan
Copy link

I have a list of 300 or so images, that needs to be split into 4. I wasn't successful to iterate over that list and apply image_slicer. Anyone can help me. Thanks

@thinklikeanarchitect
Copy link

thinklikeanarchitect commented Mar 21, 2021

You need to create a directory named 'slices' at the same directory where the code below will work.

import glob, os
import image_slicer

os.chdir("./")
for file in glob.glob("*.png"):
    image_slicer.slice(file, 4, save=False)
    image_slicer.save_tiles(tiles, directory='./slices',\
                            prefix=file, format='png')

@ritog
Copy link

ritog commented May 22, 2021

I used a for loop. Worked fine.

Listed all files in the directory using os.listdir() method, and then iterated through the loop.

I had about 12,000 high-res images. It took about 4-5 hours.

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

No branches or pull requests

3 participants