{"id":17590763,"url":"https://github.com/setanarut/decompose","last_synced_at":"2025-04-13T03:57:59.332Z","repository":{"id":204960640,"uuid":"713060351","full_name":"setanarut/decompose","owner":"setanarut","description":"Decompose image into layers (Fast Soft Color Segmentation)","archived":false,"fork":false,"pushed_at":"2024-01-31T22:59:17.000Z","size":2062,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T03:57:51.451Z","etag":null,"topics":["alpha-compositing","color-separation","decomposition","image-processing","pytorch-implementation","segmentation"],"latest_commit_sha":null,"homepage":"","language":"Python","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/setanarut.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-01T18:55:21.000Z","updated_at":"2024-12-15T13:50:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"308ebf69-86bf-4cde-aa06-fdf69531e736","html_url":"https://github.com/setanarut/decompose","commit_stats":null,"previous_names":["setanarut/decompose"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Fdecompose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Fdecompose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Fdecompose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setanarut%2Fdecompose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/setanarut","download_url":"https://codeload.github.com/setanarut/decompose/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661705,"owners_count":21141450,"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":["alpha-compositing","color-separation","decomposition","image-processing","pytorch-implementation","segmentation"],"created_at":"2024-10-22T04:24:35.204Z","updated_at":"2025-04-13T03:57:59.277Z","avatar_url":"https://github.com/setanarut.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Decompose\n\n[Fast Soft Color Segmentation](https://github.com/pfnet-research/FSCS) without `Residue predictor`.\n[Paper PDF](https://arxiv.org/pdf/2004.08096.pdf)\n\n## Installation\n\n```bash\npip install git+https://github.com/setanarut/decompose \n```\n\n## Example\n\n```python\n\nfrom decompose.decomposer import decompose\nfrom PIL import Image\n\nimg = Image.open(\"image.jpg\")\nlayers = decompose(img)\n\nfor layer in layers:\n    print(layer)\n\n# Decomposer mask generation...\n# Decomposer processing alpha layers...\n# Decomposer Done!\n# \u003cPIL.Image.Image image mode=RGBA size=904x368 at 0x1144F71D0\u003e\n# \u003cPIL.Image.Image image mode=RGBA size=904x368 at 0x111EA4A90\u003e\n# \u003cPIL.Image.Image image mode=RGBA size=904x368 at 0x114585510\u003e\n# \u003cPIL.Image.Image image mode=RGBA size=904x368 at 0x114587790\u003e\n# \u003cPIL.Image.Image image mode=RGBA size=904x368 at 0x1145856D0\u003e\n# \u003cPIL.Image.Image image mode=RGBA size=904x368 at 0x1145858D0\u003e\n# \u003cPIL.Image.Image image mode=RGBA size=904x368 at 0x114585C90\u003e\n```\n\nYou can write layers as [ORA](https://docs.krita.org/en/general_concepts/file_formats/file_ora.html) file\n\n```python\nfrom decompose.utils import images_to_ORA\n\nimages_to_ORA(layers).save(\"img.ora\")\n```\n\nIf palette is not given as an argument, a palette is created automatically. Colors can be selected manually.\n\n```python\nmanual_palette = [\n    (255, 255, 255),\n    (3, 135, 3),\n    (3, 193, 160),\n    (1, 167, 255),\n    (255, 243, 0),\n    (193, 0, 0),\n    (3, 0, 2),\n]\nlayers = decompose(img, manual_palette)\n```\n\n## decomp command-line tool example\n\nSaves layers as ORA (Open Raster) file. It can be opened with Krita. Also saves the palette.\n\n```bash\n$ decomp ~/Desktop/img.png\n\n# Decomposer mask generation...\n# Decomposer processing alpha layers...\n# Decomposer Done!\n# ORA saved: img.ora\n# 7\n# Palette saved: img_palette.png\n```\n\n## Note\n\nThe model only supports 7 colors. The same color can be repeated for less color.\n\n![palette](./assets/palette.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetanarut%2Fdecompose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsetanarut%2Fdecompose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetanarut%2Fdecompose/lists"}