/gcloud-image-transformer

🖼🔨 Optimize images hosted on Google Cloud Storage.

Primary LanguagePython

Google Cloud Storage Image Transformer

Python Pillow Requests Google Cloud Functions GitHub Last Commit GitHub Issues GitHub Stars GitHub Forks

Turn any Google Storage Bucket into a CDN for auto-optimized images. GCP Image Transformer ensures that any image added to a GCP bucket has retina, standard definition, webp, and other variants.

Getting Started

Installation with Pipenv:

$ git clone https://github.com/hackersandslackers/gcloud_image_transformer.git
$ cd gcloud-image-transformer
$ pipenv shell
$ pipenv update
$ python3 main.py

Installation via Poetry:

$ git clone https://github.com/hackersandslackers/gcloud_image_transformer.git
$ cd gcloud-image-transformer
$ poetry install
$ poetry run

Alternatively, try installing via setup.py:

$ git clone https://github.com/hackersandslackers/gcloud_image_transformer.git
$ cd gcloud-image-transformer
$ python3 setup.py run

The following environment variables are required to run this script:

  • GCP_BUCKET_URL: Publicly accessible URL of gcloud bucket.
  • GCP_BUCKET_NAME: Friendly name of bucket.
  • GOOGLE_APPLICATION_CREDENTIALS: /path/to/service_key.json
  • GCP_BUCKET_FOLDER_NAME (optional): /path/to/images