{"id":15433104,"url":"https://github.com/simonw/s3-image-proxy","last_synced_at":"2025-10-15T18:27:06.544Z","repository":{"id":53443864,"uuid":"259668056","full_name":"simonw/s3-image-proxy","owner":"simonw","description":"A tiny proxy for serving and resizing images fetched from a private S3 bucket","archived":false,"fork":false,"pushed_at":"2020-05-21T20:21:28.000Z","size":16,"stargazers_count":36,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-18T07:54:07.462Z","etag":null,"topics":["pillow","starlette","vercel"],"latest_commit_sha":null,"homepage":"https://s3-image-proxy.now.sh","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-28T14:56:00.000Z","updated_at":"2024-08-16T13:25:15.000Z","dependencies_parsed_at":"2022-08-17T19:10:24.609Z","dependency_job_id":null,"html_url":"https://github.com/simonw/s3-image-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fs3-image-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fs3-image-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fs3-image-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fs3-image-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/s3-image-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249753110,"owners_count":21320664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pillow","starlette","vercel"],"created_at":"2024-10-01T18:31:48.696Z","updated_at":"2025-10-15T18:27:01.496Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# s3-image-proxy\n\nTiny [Starlette](https://www.starlette.io/) application for retrieving image files from a private S3 bucket, resizing them based on querystring parameters and serving them with cache headers so the resized images can be cached by a CDN.\n\nSee [Using SQL to find my best photo of a pelican according to Apple Photos](https://simonwillison.net/2020/May/21/apple-photos-sqlite/) for background information on this project.\n\n## Demo\n\nYou can see a demo of this proxy in action serving images [on this page](https://dogsheep-photos.dogsheep.net/public/photos_with_apple_metadata).\n\n## Configuration\n\nThe following environment variables are required:\n\n- `S3_BUCKET`\n- `S3_AWS_ACCESS_KEY_ID`\n- `S3_AWS_SECRET_ACCESS_KEY`\n\nHere [are some notes](https://github.com/dogsheep/dogsheep-photos/issues/4) on creating an S3 bucket with the right credentials.\n\nIf you want to be able to access the original image files, set a `ORIGINAL_TOKEN` with a secret token that you plan to use to access the originals.\n\n## Deployment\n\nYou can deploy this tool directly to [Vercel](https://vercel.com/). You'll need to set the necessary environment variables.\n\nVercel provides a CDN, so resized images should be served very quickly on subsequent requests to the same image.\n\n## Local development\n\nFor local development you will need to install an additional dependency: uvicorn.\n\n    pip install -r requirements.txt\n    pip install uvicorn\n\nYou can then run the server like this:\n\n    S3_AWS_ACCESS_KEY_ID=\"xxx\" \\\n    S3_AWS_SECRET_ACCESS_KEY=\"yyy\" \\\n    S3_BUCKET=\"your-bucket\" \\\n    ORIGINAL_TOKEN=\"your-secret-token\" \\\n    uvicorn index:app\n\n## Usage\n\nOnce up and running, you can access image files stored in the S3 bucket like so:\n\n    http://localhost:8000/i/name-of-file.jpeg\n\nTo resize the image, pass ?w= or ?h= arguments:\n\n    http://localhost:8000/i/name-of-file.jpeg?w=400\n    http://localhost:8000/i/name-of-file.jpeg?h=400\n\nUse `?bw=1` to convert the image to black and white.\n\nIf you are serving JPEGs you can control the quality using `?q=` - e.g. `?q=25` for a lower quality (but faster loading) image.\n\nTo access the original image file, use this URL:\n\n    http://localhost:8000/o/name-of-file.jpeg?token=YOUR_SECRET_TOKEN\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fs3-image-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fs3-image-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fs3-image-proxy/lists"}