{"id":15391023,"url":"https://github.com/michalkvasnicak/imaginarium","last_synced_at":"2025-04-15T21:45:44.960Z","repository":{"id":44159680,"uuid":"167957566","full_name":"michalkvasnicak/imaginarium","owner":"michalkvasnicak","description":"🖼️ Serverless javascript image processor based on Sharp","archived":false,"fork":false,"pushed_at":"2023-01-03T16:49:18.000Z","size":15698,"stargazers_count":7,"open_issues_count":20,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T21:45:37.850Z","etag":null,"topics":["aws","aws-lambda","image-processing","images","javascript","libvips","nodejs","sharp","vips"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/michalkvasnicak.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":"2019-01-28T12:19:37.000Z","updated_at":"2023-12-01T17:22:14.000Z","dependencies_parsed_at":"2023-02-01T08:00:24.415Z","dependency_job_id":null,"html_url":"https://github.com/michalkvasnicak/imaginarium","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fimaginarium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fimaginarium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fimaginarium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fimaginarium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michalkvasnicak","download_url":"https://codeload.github.com/michalkvasnicak/imaginarium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249161075,"owners_count":21222464,"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":["aws","aws-lambda","image-processing","images","javascript","libvips","nodejs","sharp","vips"],"created_at":"2024-10-01T15:09:39.620Z","updated_at":"2025-04-15T21:45:44.942Z","avatar_url":"https://github.com/michalkvasnicak.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Imaginarium [![CircleCI](https://circleci.com/gh/michalkvasnicak/imaginarium.svg?style=svg\u0026circle-token=b0329dc8351a6274382784ef0a750a146b597a7b)](https://circleci.com/gh/michalkvasnicak/imaginarium)\n\n🖼️ Serverless javascript image processor based on [Sharp](http://sharp.pixelplumbing.com/en/stable/).\n\nSupports:\n\n- content negotiation based on `Accept` header with following output formats:\n  - `image/jpeg`\n  - `image/png`\n  - `image/webp`\n- resizing modes:\n  - `cover`\n  - `contain`\n  - `fill`\n  - `inside`\n  - `outside`\n\n## Structure of URL and supported operations\n\n### Original\n\nReturns the original image with applied parameters (`quality, blur, etc`).\n\n```\n/{filename}\n/{filename}/parameters?\n```\n\n### Cover mode\n\nThe replaced content is sized to maintain its aspect ratio while filling the element’s entire content box. If the object's aspect ratio does not match the aspect ratio of its box, then the object will be clipped to fit.\n\n```\n/{filename}/{unlarge}?/resize|cover/w{width}/{settings/filters}?\n/{filename}/{unlarge}?/resize|cover/h{width}/{settings/filters}?\n/{filename}/{unlarge}?/resize|cover/{width}x{height}/{settings/filters}?\n```\n\n### Contain mode\n\nThe replaced content is scaled to maintain its aspect ratio while fitting within the element’s content box. The entire object is made to fill the box, while preserving its aspect ratio, so the object will be \"letterboxed\" if its aspect ratio does not match the aspect ratio of the box.\n\n```\n/filename/{unlarge}?/contain/{bgcolor}?/{width}x{height}/{filters}?\n```\n\n### Fill mode\n\nThe replaced content is sized to fill the element’s content box. The entire object will completely fill the box. If the object's aspect ratio does not match the aspect ratio of its box, then the object will be stretched to fit.\n\n```\n/filename/{unlarge}?/fill/{width}x{height}/{filters}?\n```\n\n### Inside mode\n\nPreserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified.\n\n```\n/filename/{unlarge}?/inside/{width}x{height}/{filters}?\n```\n\n### Outside mode\n\nPreserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified\n\n```\n/filename/{unlarge}?/outside/{width}x{height}/{filters}?\n```\n\n### Settings and filters\n\n#### Blur\n\n- `blur` - performs a fast, mild blur of the output image\n- `blur(sigma)` - where `sigma` is number between `0.3` and `1000` performs a slower, more accurate Gaussian blur.\n\n#### Quality\n\n- `quality(value)` - where `value` is number between `1` and `100`, `default` is `80`\n\n#### Progressive (only `jpeg` and `png`)\n\n- `progressive(1|true)` - sets output image as progressive\n\n#### Alpha Quality (only `webp`)\n\n- `alphaQuality(value)` - where `value` is number between `1` and `100`\n\n#### Rotate\n\n- `rotate(angle)`\n  - `angle` is angle of rotation\n- `rotate(angle,color)`\n  - `angle` is angle of rotation\n  - `color` is hex color or `rgb()` or `rgba()`\n\n## Installation\n\n```console\ngit clone git@github.com:michalkvasnicak/imaginarium\ncd imaginarium\n\n# yarn is recommended because this project uses yarn\nyarn install\n# or\nnpm install\n```\n\n## Usage\n\n### Configuration\n\nMake sure you set these environment variables\n\n- `AWS_REGION` (**required**): AWS Region where your function will be deployed\n- `AWS_ACCESS_KEY_ID` (**required**): Access Key ID used to deploy to AWS\n- `AWS_SECRET_ACCESS_KEY` (**required**): Secret key used to deploy to AWS\n- `S3_IMAGE_BUCKET` (**required**): AWS S3 Bucket name where your image files are stored\n- `S3_FUNCTION_BUCKET` (**required**): AWS S3 Bucket where function packages will be stored (you must create it before deploy)\n- `S3_IMAGE_KEY_PATTERN` (**optional**, _`:filename`_): Optional image bucket key pattern. Use `:filename` as a placeholder for filename from URI, pattern cannot end or start with `/`.\n- `CDN_CERTIFICATE_ARN` (**optional**): SSL Certificate ARN from AWS Certificate Manager (_`arn:aws:acm:us-east-1:{YOUR ACCOUNT ID}:certificate/{CERTIFICATE ID}`_)\n- `CDN_ALIASES` (**optional**): The comma separated list of domains that will be associated with CloudFront distribution\n- `STACK_NAME` (**optional**, _imaginarium_): Name of stack in AWS Cloud Formation\n\n### Run locally\n\n```console\nyarn start\n# or\nnpm start\n```\n\nAnd it will start to listen on [http://localhost:3000](http://localhost:3000)\n\n### Deploy to AWS\n\n```console\nyarn deploy\n# or\nnpm run deploy\n```\n\nThis command will use [Docker](https://www.docker.com/) so make sure you have Docker installed on your system. Docker is used to prepare Sharp with binaries for AWS Lambda runtime.\n\nThen it will deploy following resources:\n\n- AWS Lambda Function\n- AWS Lambda Api Gateway\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalkvasnicak%2Fimaginarium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichalkvasnicak%2Fimaginarium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalkvasnicak%2Fimaginarium/lists"}