GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python-docs-samples/run/image-processing at main · DataSolveProblems/python-docs-samples

Expand file tree

/

image-processing

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

image-processing

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
test-images
test-images
 
 
.dockerignore
.dockerignore
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
cloudbuild.yaml
cloudbuild.yaml
 
 
e2e_test.py
e2e_test.py
 
 
image.py
image.py
 
 
image_test.py
image_test.py
 
 
main.py
main.py
 
 
main_test.py
main_test.py
 
 
noxfile_config.py
noxfile_config.py
 
 
requirements-test.txt
requirements-test.txt
 
 
requirements.txt
requirements.txt
 
 

README.md

Outline

Cloud Run Image Processing Sample

This sample service applies Cloud Storage-triggered image processing with Cloud Vision API analysis and ImageMagick transformation.

Use it with the Image Processing with Cloud Run tutorial.

Run in Google Cloud

Build

docker build --tag pubsub-tutorial:python .

Run Locally

docker run --rm -p 9090:8080 -e PORT=8080 pubsub-tutorial:python

Test

pytest

Note: you may need to install pytest using pip install pytest.

Deploy

# Set an environment variable with your GCP Project ID
export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>

# Submit a build using Google Cloud Build
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/pubsub-tutorial

# Deploy to Cloud Run
gcloud run deploy pubsub-tutorial --image gcr.io/${GOOGLE_CLOUD_PROJECT}/pubsub-tutorial --set-env-vars=BLURRED_BUCKET_NAME=<BLURRED_BUCKET_NAME>

Environment Variables

Cloud Run services can be configured with Environment Variables. Required variables for this sample include:

  • INPUT_BUCKET_NAME: The Cloud Run service will be notified of images uploaded to this Cloud Storage bucket. The service will then retrieve and process the image.
  • BLURRED_BUCKET_NAME: The Cloud Run service will write blurred images to this Cloud Storage bucket.

Maintenance Note

  • The image.py file is copied from the Cloud Functions ImageMagick sample main.py. Region tags are changed.
  • The requirements.txt dependencies used in the copied code should track the Cloud Functions ImageMagick requirements.txt
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.