{"id":28252439,"url":"https://github.com/none-none1/sourceshot","last_synced_at":"2025-09-06T14:42:10.023Z","repository":{"id":179094481,"uuid":"659977624","full_name":"none-None1/sourceshot","owner":"none-None1","description":"Takes pictures of code!","archived":false,"fork":false,"pushed_at":"2024-02-19T13:40:18.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-26T01:46:33.380Z","etag":null,"topics":["image-processing","syntax-highlighting"],"latest_commit_sha":null,"homepage":"","language":"Python","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/none-None1.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-29T01:35:02.000Z","updated_at":"2023-07-24T01:58:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"d42ecf8b-09b9-4a4a-8586-9e2995d50ba7","html_url":"https://github.com/none-None1/sourceshot","commit_stats":null,"previous_names":["none-none1/sourceshot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/none-None1/sourceshot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/none-None1%2Fsourceshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/none-None1%2Fsourceshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/none-None1%2Fsourceshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/none-None1%2Fsourceshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/none-None1","download_url":"https://codeload.github.com/none-None1/sourceshot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/none-None1%2Fsourceshot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273919077,"owners_count":25191204,"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-09-06T02:00:13.247Z","response_time":2576,"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":["image-processing","syntax-highlighting"],"created_at":"2025-05-19T16:15:46.486Z","updated_at":"2025-09-06T14:42:09.964Z","avatar_url":"https://github.com/none-None1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Downloads](https://static.pepy.tech/badge/sourceshot)](https://pepy.tech/project/sourceshot) [![Downloads](https://static.pepy.tech/badge/sourceshot/month)](https://pepy.tech/project/sourceshot) [![Downloads](https://static.pepy.tech/badge/sourceshot/week)](https://pepy.tech/project/sourceshot)\n\nThe purpose of this package is taking pictures of code.\n\nTo run sourceshot, do\n```\nfrom sshot import shot\nfrom PIL import Image\ncode='''\nprint('Hello World!')\n'''\nimage=shot(code,lang='python')\nImage.fromarray(image).save('code.png')\n```\n\nThe code above will create something like:\n![](https://i.postimg.cc/sxLHWpJ7/code.png)\n\nUse in command line:\n```commandline\nsshot -i test.py -l python -o code.png\nsshot -i test.py -l python -o code.png -b bg.png # Add background image.\nsshot -i test.py -l python -o code.png -b 00FF00FF0000 # Red code background color, green line number background color.\nsshot -i test.py -l python # Show the image in a tkinter window.\n```\n\nHere is a picture of a C++ program generated using this tool:\n![](https://i.postimg.cc/vThsBYJh/rc.png)\n\n\nIt is also supported to set the background image of code, like:\n\n```python\nfrom sshot import shot\nfrom PIL import Image\nfrom sshot.background import Background\nimport numpy as np\ncode='''\nprint('Hello World!')\n'''\nbg=np.array(Image.open('bg.png'))\nimage=shot(code,lang='python',background=Background(bg))\nImage.fromarray(image).save('code.png')\n```\n\n### Syntax highlight config in JSON file.\n\nA correct syntax highlight config should have a 'config' key.\nIt can also have an optional 'default' key.\n\nThe 'config' key is a dictionary, the key in that dictionary stands for the token name in the TokenChecker class (builtin, identifier, etc.)\nThe 'default' key stands for the default color.\n\nFor example:\n\n```json\n{\n  \"config\": {\n    \"builtin\": [127,0,0],\n    \"exception\": [0,127,0],\n    \"string\": [0,0,127]\n  },\n  \"default\": [127,127,127]\n}\n```\n\nUsing the JSON file above to create a picture of the code \"print('Hello World!'), you will get:\n![](https://i.postimg.cc/Mp48Jdxz/code2.png)\n\nHow to install?\n\n```commandline\npip install sourceshot\n```\n\n[link](https://pypi.org/project/sourceshot/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnone-none1%2Fsourceshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnone-none1%2Fsourceshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnone-none1%2Fsourceshot/lists"}