{"id":13549118,"url":"https://github.com/humanmade/Gaussholder","last_synced_at":"2025-04-02T22:31:28.596Z","repository":{"id":41183312,"uuid":"41280958","full_name":"humanmade/Gaussholder","owner":"humanmade","description":"Fast and lightweight image previews, using Gaussian blur","archived":false,"fork":false,"pushed_at":"2023-10-18T11:12:14.000Z","size":7273,"stargazers_count":196,"open_issues_count":9,"forks_count":17,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-25T14:45:47.877Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/humanmade.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-08-24T03:58:45.000Z","updated_at":"2025-01-12T10:28:41.000Z","dependencies_parsed_at":"2024-01-16T18:23:50.631Z","dependency_job_id":null,"html_url":"https://github.com/humanmade/Gaussholder","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2FGaussholder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2FGaussholder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2FGaussholder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2FGaussholder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humanmade","download_url":"https://codeload.github.com/humanmade/Gaussholder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246905105,"owners_count":20852812,"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":[],"created_at":"2024-08-01T12:01:18.449Z","updated_at":"2025-04-02T22:31:24.561Z","avatar_url":"https://github.com/humanmade.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"\u003ctable width=\"100%\"\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd align=\"left\" width=\"70\"\u003e\n\t\t\t\u003cstrong\u003eGaussholder\u003c/strong\u003e\u003cbr /\u003e\n\t\t\t Fast and lightweight image previews, using Gaussian blur.\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"right\" width=\"20%\"\u003e\n\t\t\t\u003c!--\n\t\t\t\u003ca href=\"https://travis-ci.org/humanmade/Gaussholder\"\u003e\n\t\t\t\t\u003cimg src=\"https://travis-ci.org/humanmade/Gaussholder.svg?branch=master\" alt=\"Build status\"\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u003ca href=\"http://codecov.io/github/humanmade/Gaussholder?branch=master\"\u003e\n\t\t\t\t\u003cimg src=\"http://codecov.io/github/humanmade/Gaussholder/coverage.svg?branch=master\" alt=\"Coverage via codecov.io\" /\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t--\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\n\t\t\tA \u003cstrong\u003e\u003ca href=\"https://hmn.md/\"\u003eHuman Made\u003c/a\u003e\u003c/strong\u003e project. Maintained by @rmccue.\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003cimg src=\"https://hmn.md/content/themes/hmnmd/assets/images/hm-logo.svg\" width=\"100\" /\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\nGaussholder is an image placeholder utility, generating accurate preview images using an amazingly small amount of data.\n\n\u003cimg src=\"preview.gif\" /\u003e\n\nThat's a **800 byte** preview image, for a **109 kilobyte** image. 800 bytes still too big? Tune the size to your liking in your configuration.\n\n**Please note:** This is still in development, and we're working on getting this production-ready, so things might not be settled yet. In particular, we're still working on tweaking the placeholder size and improving the lazyloading code. Avoid using this in production.\n\n## How does it work?\n\nGaussholder is inspired by [Facebook Engineering's fantastic post][fbeng] on generating tiny preview images. Gaussholder takes the concepts from this post and applies them to the wild world of WordPress.\n\nIn a nutshell, Gaussholder takes a Gaussian blur and applies it to an image to generate a preview image. Gaussian blurs work as a low-pass filter, allowing us to throw away a lot of the data. We then further reduce the amount of data per image by removing the JPEG header and rebuilding it on the client side (this eliminates ~800 bytes from each image).\n\nWe further reduce the amount of data for some requests by lazyloading images.\n\n[fbeng]: https://code.facebook.com/posts/991252547593574\n\n## How do I use it?\n\nGaussholder is designed for high-volume sites for seriously advanced users. Do _not_ install this on your regular WP site.\n\n1. Download and activate the plugin from this repo.\n2. Select the image sizes to use Gaussholder on, and add them to the array on the `gaussholder.image_sizes` filter.\n3. If you have existing images, regenerate the image thumbnails.\n\nYour filter should look something like this:\n\n```php\nadd_filter( 'gaussholder.image_sizes', function ( $sizes ) {\n\t$sizes['medium'] = 16;\n\t$sizes['large'] = 32;\n\t$sizes['full'] = 84;\n\treturn $sizes;\n} );\n```\n\nThe keys are registered image sizes (plus `full` for the original size), with the value as the desired blur radius in pixels.\n\nBy default, Gaussholder won't generate any placeholders, and you need to opt-in to using it. Simply filter here, and add the size names for what you want generated.\n\nBe aware that for every size you add, a placeholder will be generated and stored in the database. If you have a lot of sizes, this will be a _lot_ of data.\n\nBy default Gaussholder is initialized with the `DOMContentLoaded` event. Should you need to reinitialize Gaussholder after the page had loaded, this can be achieved with `GaussHolder();`.\n\n### Blur radius\n\nThe blur radius controls how much blur we use. The image is pre-scaled down by this factor, and this is really the key to how the placeholders work. Increasing radius decreases the required data quadratically: a radius of 2 uses a quarter as much data as the full image; a radius of 8 uses 1/64 the amount of data. (Due to compression, the final result will *not* follow this scaling.)\n\nBe careful tuning this, as decreasing the radius too much will cause a huge amount of data in the body; increasing it will end up with not enough data to be an effective placeholder.\n\nThe radius needs to be tuned to each size individually. Facebook uses about 200 bytes of data for their placeholders, but you may want higher quality placeholders. There's no ideal radius, as you simply want to balance having a useful placeholder with the extra time needed to process the data on the page.\n\nGaussholder includes a CLI command to help you tune the radius: pick a representative attachment or image file and use `wp gaussholder check-size \u003cid_or_image\u003e \u003cradius\u003e`. Adjust the radius until you get to roughly 200B, then check against other attachments to ensure they're in the ballpark.\n\nNote: changing the radius requires regenerating the placeholder data. Run `wp gaussholder process-all --regenerate` after changing radii or adding new sizes.\n\n## License\nGaussholder is licensed under the GPLv2 or later.\n\nGaussholder uses StackBlur, licensed under the MIT license.\n\nSee [LICENSE.md](LICENSE.md) for further details.\n\n## Credits\nCreated by Human Made for high volume and large-scale sites.\n\nWritten and maintained by [Ryan McCue](https://github.com/rmccue). Thanks to all our [contributors](https://github.com/humanmade/Gaussholder/graphs/contributors). (Thanks also to fellow humans Matt and Paul for the initial placeholder code.)\n\nGaussholder is heavily inspired by [Facebook Engineering's post][fbeng], and would not have been possible without it. In particular, the techniques of downscaling before blurring and extracting the JPEG header are particularly novel, and the key to why Gaussholder exists.\n\nInterested in joining in on the fun? [Join us, and become human!](https://hmn.md/is/hiring/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2FGaussholder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumanmade%2FGaussholder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2FGaussholder/lists"}