{"id":21878979,"url":"https://github.com/nitro/imgdeflator","last_synced_at":"2026-01-30T03:51:58.677Z","repository":{"id":287994769,"uuid":"169439800","full_name":"Nitro/imgdeflator","owner":"Nitro","description":"A small web server which handles POST requests to resize images","archived":false,"fork":false,"pushed_at":"2022-12-15T12:34:38.000Z","size":10242,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-15T03:06:58.035Z","etag":null,"topics":["go","k8snamespace-nitro-cloud","owner-nitrosign","product-nitrosign","terraform-managed","type-backend"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nitro.png","metadata":{},"created_at":"2019-02-06T16:44:35.000Z","updated_at":"2025-04-08T09:41:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Nitro/imgdeflator","commit_stats":null,"previous_names":["nitro/imgdeflator"],"tags_count":null,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitro%2Fimgdeflator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitro%2Fimgdeflator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitro%2Fimgdeflator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nitro%2Fimgdeflator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nitro","download_url":"https://codeload.github.com/Nitro/imgdeflator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997081,"owners_count":21195799,"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":["go","k8snamespace-nitro-cloud","owner-nitrosign","product-nitrosign","terraform-managed","type-backend"],"created_at":"2024-11-28T08:14:17.633Z","updated_at":"2026-01-30T03:51:53.667Z","avatar_url":"https://github.com/Nitro.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# imgdeflator\n\nImgdeflator is a small web server which handles `POST` requests with image attachments. It passes the received image through [`libvips`](https://libvips.org/) to resize it to the specified width/height and then it stores it on S3 at the specified path.\n\nIt uses [urlsign](https://github.com/Nitro/urlsign) to validate the signature `token` in the request URL.\n\nKudos to [DarthSim](https://github.com/DarthSim) for writing [imgproxy](https://github.com/DarthSim/imgproxy), which served as inspiration for this library!\n\n## Building imgdeflator locally\n\n```shell\ngo get github.com/Nitro/imgdeflator\n```\n\n## Running imgdeflator locally\n\nJust run the executable. By default, it will bind to port `8080` and handle POST requests in the following format:\n\n```\nhttp://127.0.0.1:8080/base64_encoded_s3_location?width=1024\u0026token=valid_token\n```\nor\n```\nhttp://127.0.0.1:8080/base64_encoded_s3_location?height=768\u0026token=valid_token\n```\n\nConfiguration is done using environment variables:\n\n- `IMGDEFLATOR_LOGGING_LEVEL`: The cut off level for log messages. Accepted values: `debug`, `info`, `warn`, `error` (default `info`).\n- `IMGDEFLATOR_MAX_UPLOAD_SIZE`: The maximum allowed size for the `POST`ed image (default `5242880` which is 5MB).\n- `IMGDEFLATOR_HTTP_PORT`: The port to listen on for HTTP connections (default `8080`).\n- `IMGDEFLATOR_UPLOAD_TIMEOUT`: The maximum allowed processing duration of the HTTP handler before sending an error to the user (default `10s`).\n- `IMGDEFLATOR_REQUEST_TIMEOUT`: The maximum allowed duration of the entire HTTP request before sending an error to the user (default `11s`).\n- `IMGDEFLATOR_DEFAULT_S3_REGION`: The default S3 region where to look for the S3 bucket of the received S3 location (default `eu-central-1`).\n- `IMGDEFLATOR_MAX_WIDTH`: The maximum `POST`ed image width (default `4096`).\n- `IMGDEFLATOR_MAX_HEIGHT`: The maximum `POST`ed image height (default `4096`).\n- `IMGDEFLATOR_URL_SIGNING_SECRET`: A secret to use when validating signed URLs (default: `deadbeef`). Set it to empty string to disable signature validation.\n- `IMGDEFLATOR_SIGNING_BUCKET_SIZE`: The `urlsign` time bucket size (default `8h`). It provides a `3*bucketSize` window of validity for each signature. See the [`urlsign`](https://github.com/Nitro/urlsign) documentation for more information.\n\n## Testing imgdeflator locally\n\n- base64-encode a valid S3 location where you wish the image to be stored and append that to the imgdeflator URL:\n\n```Shell\n\u003e echo -n \"s3://nitro-junk/imgdeflator.jpg\" | base64 | tr '=' '\\0' | xargs -I {} echo \"http://127.0.0.1:8080/{}\"\nhttp://127.0.0.1:8080/czM6Ly9uaXRyby1qdW5rL2ltZ2RlZmxhdG9yLmpwZw\n```\n\n- Instruct imgdeflator to shrink `resources/tweety.jpg` to have `width=1024` and store it at `s3://nitro-junk/imgdeflator.jpg`:\n\n```Shell\n\u003e curl -v -H \"Content-Type: image/jpeg\" --data-binary \"@resources/tweety.jpg\" \"http://127.0.0.1:8080/czM6Ly9uaXRyby1qdW5rL2ltZ2RlZmxhdG9yLmpwZw?width=1024\"\n```\n\n# Copyright\n\nCopyright (c) 2019 Nitro Software.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitro%2Fimgdeflator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitro%2Fimgdeflator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitro%2Fimgdeflator/lists"}