{"id":13579240,"url":"https://github.com/contao/imagine-svg","last_synced_at":"2025-06-12T08:09:07.297Z","repository":{"id":41351356,"uuid":"52290260","full_name":"contao/imagine-svg","owner":"contao","description":"Contao Imagine SVG Library","archived":false,"fork":false,"pushed_at":"2025-02-03T11:18:45.000Z","size":179,"stargazers_count":84,"open_issues_count":1,"forks_count":9,"subscribers_count":4,"default_branch":"1.x","last_synced_at":"2025-04-05T20:35:23.385Z","etag":null,"topics":["cms","contao","image","php","resizer","svg"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/contao.png","metadata":{"funding":{"custom":"https://to.contao.org/donate"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-22T17:10:36.000Z","updated_at":"2025-03-20T19:52:52.000Z","dependencies_parsed_at":"2025-02-03T12:23:58.664Z","dependency_job_id":"9a22b823-4b45-4ac1-9023-9922828f3ad2","html_url":"https://github.com/contao/imagine-svg","commit_stats":{"total_commits":131,"total_committers":5,"mean_commits":26.2,"dds":"0.36641221374045807","last_synced_commit":"f52276d6f4384016b32e430f78457b851fbf068b"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/contao/imagine-svg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contao%2Fimagine-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contao%2Fimagine-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contao%2Fimagine-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contao%2Fimagine-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contao","download_url":"https://codeload.github.com/contao/imagine-svg/tar.gz/refs/heads/1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contao%2Fimagine-svg/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259427060,"owners_count":22855562,"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":["cms","contao","image","php","resizer","svg"],"created_at":"2024-08-01T15:01:37.648Z","updated_at":"2025-06-12T08:09:07.243Z","avatar_url":"https://github.com/contao.png","language":"PHP","funding_links":["https://to.contao.org/donate"],"categories":["PHP"],"sub_categories":[],"readme":"Contao Imagine SVG library\n==========================\n\n[![](https://img.shields.io/github/actions/workflow/status/contao/imagine-svg/ci.yml?branch=1.x\u0026style=flat-square)](https://github.com/contao/imagine-svg/actions?query=branch%3A1.x)\n[![](https://img.shields.io/codecov/c/github/contao/imagine-svg/1.x.svg?style=flat-square)](https://codecov.io/gh/contao/imagine-svg)\n[![](https://img.shields.io/packagist/v/contao/imagine-svg.svg?style=flat-square)](https://packagist.org/packages/contao/imagine-svg)\n[![](https://img.shields.io/packagist/dt/contao/imagine-svg.svg?style=flat-square)](https://packagist.org/packages/contao/imagine-svg)\n\nThis project implements the interfaces of [Imagine][1] and allows you to make\nsimple modifications to SVG images. It is used in [Contao][2] to handle\non-the-fly resizing of SVG images.\n\nInstallation\n------------\n\n```sh\nphp composer.phar require contao/imagine-svg\n```\n\nUsage\n-----\n\n```php\nuse Contao\\ImagineSvg\\Imagine;\nuse Imagine\\Image\\Box;\nuse Imagine\\Image\\Point;\n\n$imagine = new Imagine();\n\n$imagine\n    -\u003eopen('/path/to/image.svg')\n    -\u003ecrop(new Point(50, 50), new Box(100, 100))\n    -\u003eresize(new Box(40, 40))\n    -\u003esave('/path/to/thumbnail.svg')\n;\n\n$image = $imagine-\u003eopen('/path/to/image.svg');\n\n$image-\u003eeffects()\n    -\u003egamma(1.5)\n    -\u003enegative()\n    -\u003egrayscale()\n    -\u003ecolorize($color)\n    -\u003esharpen()\n    -\u003eblur(2)\n;\n\n$image-\u003esave('/path/to/image.svg');\n```\n\nBecause of the nature of SVG images, the `getSize()` method differs a little bit\nfrom other implementations. You can check the return value like in this example:\n\n```php\nuse Contao\\ImagineSvg\\Imagine;\nuse Contao\\ImagineSvg\\SvgBox;\n\n$imagine = new Imagine();\n$size = $imagine-\u003eopen('/path/to/image.svg')-\u003egetSize();\n\nif (SvgBox::TYPE_NONE === $size-\u003egetType()) {\n    // The image has no defined size\n} elseif (SvgBox::TYPE_ASPECT_RATIO === $size-\u003egetType()) {\n    // The image has a relative size, $size-\u003egetWidth() and $size-\u003egetHeight()\n    // should be treated as an aspect ratio\n} else {\n    // The image has a defined size like a regular image\n    // $size-\u003egetType() would return SvgBox::TYPE_ABSOLUTE in this case\n}\n```\n\n[1]: https://github.com/avalanche123/Imagine\n[2]: https://contao.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontao%2Fimagine-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontao%2Fimagine-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontao%2Fimagine-svg/lists"}