{"id":21344446,"url":"https://github.com/freshleafmedia/image-compression-finder","last_synced_at":"2025-07-27T01:07:36.711Z","repository":{"id":64607232,"uuid":"576904107","full_name":"freshleafmedia/image-compression-finder","owner":"freshleafmedia","description":"Automatic detection of maximum compression without visually changing the image","archived":false,"fork":false,"pushed_at":"2022-12-17T20:57:53.000Z","size":1512,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-26T06:12:16.080Z","etag":null,"topics":["automation","compression","image-compression","image-processing"],"latest_commit_sha":null,"homepage":"https://www.freshleafmedia.co.uk/blog/automatically-find-best-image-compression","language":"PHP","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/freshleafmedia.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":"2022-12-11T11:21:11.000Z","updated_at":"2023-02-28T11:01:19.000Z","dependencies_parsed_at":"2023-01-29T18:01:19.516Z","dependency_job_id":null,"html_url":"https://github.com/freshleafmedia/image-compression-finder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/freshleafmedia/image-compression-finder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freshleafmedia%2Fimage-compression-finder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freshleafmedia%2Fimage-compression-finder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freshleafmedia%2Fimage-compression-finder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freshleafmedia%2Fimage-compression-finder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/freshleafmedia","download_url":"https://codeload.github.com/freshleafmedia/image-compression-finder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/freshleafmedia%2Fimage-compression-finder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267278801,"owners_count":24063267,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["automation","compression","image-compression","image-processing"],"created_at":"2024-11-22T01:19:05.819Z","updated_at":"2025-07-27T01:07:36.679Z","avatar_url":"https://github.com/freshleafmedia.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Compression Finder\n\nAutomatic detection of maximum compression without visually changing the image.\n\n\n## Overview\n\nThis is a library which attempts to determine the maximum amount of compression which can be applied \nto an image while not introducing any visible changes.\n\nThe output is an integer between 0 and 100.\n\n\n## Installation\n\n```\ncomposer require freshleafmedia/image-compression-finder\n```\n\n### DSSIM\n\nA working copy of [kornelski/dssim](https://github.com/kornelski/dssim) must be installed.\n\nTo install the latest, at time of writing, on Ubuntu the following one-liner can be used:\n\n```\ncurl -sSL https://github.com/kornelski/dssim/releases/download/3.2.3/dssim_3.2.3_amd64.deb \u003e /tmp/dssim.deb \u0026\u0026 apt install /tmp/dssim.deb\n```\n\n### Imagick/GD\n\nEither of Imagick or GD extensions are required.\n\n\n\n## Usage\n\n```php\nuse FreshleafMedia\\ImageCompressionFinder\\ImageCompressionFinder;\n\n$quality = ImageCompressionFinder::make()-\u003erun('/path/to/image');\n\n$quality; // 66 (0-100)\n```\n\n\n## How it works\n\nThe algorithm uses a binary search to repeatedly compress and test an image until the ideal quality is found\n\n1. Compress the image with a quality setting of 60\n2. Analyse the new image using DSSIM\n3. If the change is within tolerance the quality is halved, if not it is increased by 50% (aka a binary search)\n4. Compress the image again with the new quality\n5. GOTO 2\n\n\n## Options\n\nThere are a couple of configuration options:\n\n```php\n$quality = ImageCompressionFinder::make()\n    -\u003emaxDifference(0.001) // The highest acceptable visual change. 0-∞ where 0 is no change at all\n    -\u003estartingQuality(60) // Where to start the search\n    -\u003edriver('imagick') // The driver to use to compress images. Eg imagick or gd\n    -\u003erun();\n```\n\n\n## Tests\n\nUnit tests can be run via `composer test`\n\n\n\n## License\n\nSee [LICENSE](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreshleafmedia%2Fimage-compression-finder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreshleafmedia%2Fimage-compression-finder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreshleafmedia%2Fimage-compression-finder/lists"}