Python 3 icrawler Library Script to Crawl and Download Multiple Images From Google Search Engine Keywords Full Project For Beginners

 

 

Welcome folks today in this blog post we will be crawling and scraping and downloading images using the icrawler library in python. All the full source code of the application is shown below.

 

 

 

Get Started

 

 

 

In order to get started you need to install the below library using the pip command as shown below

 

 

pip install icrawler

 

 

After installing this library you need to make an app.py file and copy paste the following code

 

Examples

 

Using built-in crawlers is very simple. A minimal example is shown as follows.

 

from icrawler.builtin import GoogleImageCrawler

google_crawler = GoogleImageCrawler(storage={'root_dir': 'your_image_dir'})
google_crawler.crawl(keyword='cat', max_num=100)

 

You can also configurate number of threads and apply advanced search options. (Note: compatible with 0.6.0 and later versions)

 

from icrawler.builtin import GoogleImageCrawler

google_crawler = GoogleImageCrawler(
    feeder_threads=1,
    parser_threads=2,
    downloader_threads=4,
    storage={'root_dir': 'your_image_dir'})
filters = dict(
    size='large',
    color='orange',
    license='commercial,modify',
    date=((2017, 1, 1), (2017, 11, 30)))
google_crawler.crawl(keyword='cat', filters=filters, max_num=1000, file_idx_offset=0)

Leave a Reply