Skip to content

vibrant-data-labs/python-download-process-images

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Download and Processing Image Module

Initial Setup

macOS

  1. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install python 3 via brew
brew install python3

If necessary, run brew link to symlink Python 3 to the main python3 command:

brew link [email protected] # or whatever version
  1. Install pip for python
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py

Or do it with brew:

brew postinstall python3

You can make sure which version you are on by running python3 --version

  1. Install pip prerequisites
## Dependencies
brew install python3 cairo imagemagick webp
python3 -m pip install -r requirements.txt

Please note that if you are using Anaconda for development, you must also install the cairo package via conda:

conda install cairo

Ubuntu

sudo apt install libcanberra-gtk-module python3-pip python3 imagemagick inkscape webp -y
python3 -m pip install -r requirements.txt

Project Setup

  1. Download or clone this repository:
git clone https://github.com/ericberlow/python-download-process-images.git
  1. Change to this project's directory in your terminal:
cd python-download-process-images
  1. Copy the sample config to your own. This file will not be committed.
cp config.sample.ini config.ini

Then edit the config, filling in your own values.

Usage as a module

import imagetools

imagetools.download_images(csv_file="sample_image_list_noextention.csv")
imagetools.process_images(resize=True,width=200,height=200,
                          grayscale=True,padding=False,
                          padding_width=100,padding_height=100)
imagetools.upload_images(s3_bucket="this-bucket")

CSV format

The .csv file must have the following positional column values for the python scripts to work (the header names do not matter):

name image_url filename

Notes

  • Cache is there to avoid unnecessary downloading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages