{"id":16124281,"url":"https://github.com/jongacnik/plh","last_synced_at":"2025-03-18T12:31:38.258Z","repository":{"id":57151182,"uuid":"82259311","full_name":"jongacnik/plh","owner":"jongacnik","description":"⬜️ base64 image placeholders","archived":false,"fork":false,"pushed_at":"2017-02-17T05:12:27.000Z","size":3,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T09:21:02.944Z","etag":null,"topics":["base64","placeholder","transparent"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/jongacnik.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-17T05:07:03.000Z","updated_at":"2022-06-14T04:11:11.000Z","dependencies_parsed_at":"2022-08-24T10:20:28.300Z","dependency_job_id":null,"html_url":"https://github.com/jongacnik/plh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fplh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fplh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fplh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jongacnik%2Fplh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jongacnik","download_url":"https://codeload.github.com/jongacnik/plh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243926063,"owners_count":20369911,"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":["base64","placeholder","transparent"],"created_at":"2024-10-09T21:20:24.880Z","updated_at":"2025-03-18T12:31:37.983Z","avatar_url":"https://github.com/jongacnik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# plh\n\nReturns a base64 encoded transparent placeholder gif as Data URI\n\n```bash\n$ npm i plh\n```\n\n**Requires [ImageMagick](https://www.imagemagick.org/)**\n\n## CLI\n\nLet's make a 1x1 pixel placeholder:\n\n```bash\n$ plh\n# → data:image/gif;base64,R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\n```\n\nYou can also pass in a width and height:\n\n```bash\n$ plh 10 50\n# → data:image/gif;base64,R0lGODlhCgAyAPAAAAAAAAAAACH5BAEAAAAALAAAAAAKADIAAAIUhI+py+0Po5y02ouz3rz7D4biiBQAOw==\n```\n\n## Node\n\nYou can also use `plh` from within node:\n\n```js\nvar plh = require('plh')\nvar base64 = plh(3, 4)\n// → data:image/gif;base64,R0lGODlhAwAEAPAAAAAAAAAAACH5BAEAAAAALAAAAAADAAQAAAIDhI9WADs=\n```\n\n## FAQ\n\n### Why?\n\nSometimes base64 encoded placeholder images are handy. I made this so I could quickly nab aspect ratio specific placeholders.\n\n### How?\n\nThe ImageMagick [`convert`](https://www.imagemagick.org/script/convert.php) command is used to create a placeholder image which is piped into the `base64` program and concated to a [data uri](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) prefix:\n\n```bash\necho 'data:image/gif;base64,'\"$(convert -size 1x1 xc:transparent gif:- | base64)\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongacnik%2Fplh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjongacnik%2Fplh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjongacnik%2Fplh/lists"}