{"id":15012802,"url":"https://github.com/iaseth/photoreactor","last_synced_at":"2026-02-23T21:05:30.134Z","repository":{"id":255043525,"uuid":"848364933","full_name":"iaseth/photoreactor","owner":"iaseth","description":"Photoreactor allows you to render HTML using JSON scripts.","archived":false,"fork":false,"pushed_at":"2024-09-05T06:35:29.000Z","size":231,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T08:11:12.016Z","etag":null,"topics":["javascript","json","playwright","python","react","screenshot"],"latest_commit_sha":null,"homepage":"https://photoreactor.redpapr.com/","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/iaseth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-27T16:19:36.000Z","updated_at":"2024-09-05T06:35:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"3ab53ed9-3587-4fe5-b792-c1d2c8a3af07","html_url":"https://github.com/iaseth/photoreactor","commit_stats":null,"previous_names":["iaseth/photoreactor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fphotoreactor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fphotoreactor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fphotoreactor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fphotoreactor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iaseth","download_url":"https://codeload.github.com/iaseth/photoreactor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fphotoreactor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259180874,"owners_count":22817824,"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":["javascript","json","playwright","python","react","screenshot"],"created_at":"2024-09-24T19:43:14.539Z","updated_at":"2025-10-31T03:33:01.301Z","avatar_url":"https://github.com/iaseth.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Photoreactor\nPhotoreactor is a `React` webapp that allows you to specify document structure\nusing JSON scripts, and renders it as HTML in the browser.\n\nThe combination of Photoreactor and Playwright can be useful for\ncreating Thumbnails/Screenshots programmatically.\n\n![Photoreactor Screenshot](png/Photoreactor-Screenshot.png)\n\nI am using [`readmix`](https://github.com/iaseth/readmix) for generating this README.\nYou can view the source file [here](https://github.com/iaseth/photoreactor/blob/master/README.md.rx).\n\n\n![Example Image](png/second-example.png)\n\nThe above image was rendered using the following JSON script.\n\n```json\n{\n    \"title\":\"Example\",\n    \"height\":\"480px\",\n    \"width\":\"1080px\",\n    \"padding\":\"60px 100px\",\n    \"backgroundColor\":\"#dc2626\",\n    \"color\":\"#eee\",\n    \"fontFamily\":\"Ubuntu\",\n    \"fontWeight\":\"700\",\n    \"borderColor\":\"#ef4444\",\n    \"borderWidth\":\"10px\",\n    \"borderStyle\":\"solid\",\n    \"children\":[\n        {\"text\":\"Photoreactor\",\"fontSize\":\"96px\"},\n        {\"text\":\"Taking Screenshots with Python\",\"fontSize\":\"48px\", \"padding\": \"10px 0px\"},\n        {\"text\":\"Created by Ankur Seth\", \"fontSize\":\"32px\", \"padding\": \"60px 0px 0px 0px\"}\n    ]\n}\n```\n\n\n## What is supported\nCurrently, all rendered elements are `div` and they can contain any number of children\nand/or a single `text` node inside them.\n\n* The following CSS properties are supported on each element:\n\n| Property          | CSS Name           |\n| ----------------- | ------------------ |\n| `backgroundColor` | `background-color` |\n| `color`           | `color`            |\n| `width`           | `width`            |\n| `height`          | `height`           |\n| `padding`         | `padding`          |\n| `margin`          | `margin`           |\n| `fontFamily`      | `font-family`      |\n| `fontSize`        | `font-size`        |\n| `fontWeight`      | `font-weight`      |\n| `lineHeight`      | `line-height`      |\n| `textAlign`       | `text-align`       |\n| `borderColor`     | `border-color`     |\n| `borderWidth`     | `border-width`     |\n| `borderStyle`     | `border-style`     |\n| `outlineColor`    | `outline-color`    |\n| `outlineWidth`    | `outline-width`    |\n| `outlineStyle`    | `outline-style`    |\n| `position`        | `position`         |\n| `top`             | `top`              |\n| `right`           | `right`            |\n| `bottom`          | `bottom`           |\n| `left`            | `left`             |\n| `zIndex`          | `z-index`          |\n\n* Tailwind color classes - all `background-color (bg-*)`, `color (text-*)` and  `border-color (border-*)` classes are supported.\n\n\n\n## What is not supported yet\nThe following features are not yet supported in Photoreact\nbut will be supported in future:\n\n* More CSS properties\n* Support for more Tailwind classes\n* Images (uploaded/URLs)\n* Videos (uploaded)\n* Custom Fonts (especially Google Fonts)\n\n\n\n## Capturing Screenshots Programmatically\nThe below script captures Screenshots using Python and Playwright.\n\n```py\nimport json\nimport shutil\nimport time\n\nfrom playwright.sync_api import Page, expect\nfrom playwright.sync_api import sync_playwright\n\n\nAPP_LOCAL_URL = \"http://localhost:5173/\"\nAPP_REMOTE_URL = \"https://photoreactor.redpapr.com/\"\n\n\ndef record_screencast(script_json, resolution, screenshot_file_path):\n\twith sync_playwright() as playwright:\n\t\tbrowser = playwright.chromium.launch(headless=True)\n\t\tcontext = browser.new_context(viewport=resolution)\n\t\tprint(\"\\tCreated browser context\")\n\n\t\tpage = context.new_page()\n\t\tt1 = time.time()\n\t\tprint(\"\\tCreated new page\")\n\t\tpage.set_default_timeout(0)\n\t\tpage.goto(APP_REMOTE_URL)\n\t\tt2 = time.time()\n\t\ttd = round(t2-t1, 1)\n\t\tprint(f\"\\tOpened photoreactor in {td} seconds\")\n\n\t\tpage.locator(\"#inputTextArea\").fill(script_json)\n\t\tpage.locator(\"#renderButton\").click()\n\t\tpage.wait_for_timeout(1000) # ensures that renderer has started\n\t\tpage.screenshot(path=screenshot_file_path);\n\n\t\tpage.close()\n\t\tcontext.close()\n\t\tbrowser.close()\n\n\t\tprint(f\"\\t\\tSaved screenshot: {screenshot_file_path}\")\n\n\ndef main():\n\tscript = {\n\t\t\"title\":\"Example\",\n\t\t\"height\":\"480px\",\n\t\t\"width\":\"1080px\",\n\t\t\"padding\":\"60px 100px\",\n\t\t\"backgroundColor\":\"#dc2626\",\n\t\t\"color\":\"#eee\",\n\t\t\"fontFamily\":\"Ubuntu\",\n\t\t\"fontWeight\":\"700\",\n\t\t\"borderColor\":\"#ef4444\",\n\t\t\"borderWidth\":\"10px\",\n\t\t\"borderStyle\":\"solid\",\n\t\t\"children\":[\n\t\t\t{\"text\":\"Photoreactor\",\"fontSize\":\"96px\"},\n\t\t\t{\"text\":\"Taking Screenshots with Python\",\"fontSize\":\"48px\", \"padding\": \"10px 0px\"},\n\t\t\t{\"text\":\"Created by Ankur Seth\", \"fontSize\":\"32px\", \"padding\": \"60px 0px 0px 0px\"}\n\t\t]\n\t}\n\n\tscript_json = json.dumps(script)\n\tresolution = {\n\t\t'height': 480,\n\t\t'width': 1080\n\t}\n\tscreenshot_file_path = \"screenshot.png\"\n\n\trecord_screencast(script_json, resolution, screenshot_file_path)\n\n\nif __name__ == '__main__':\n\tmain()\n\n```\n\n\n## License\nMIT License\n\nCopyright (c) Ankur Seth.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n## Credit\n\nThis file was generated using [`readmix`](https://github.com/iaseth/readmix).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiaseth%2Fphotoreactor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiaseth%2Fphotoreactor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiaseth%2Fphotoreactor/lists"}