{"id":26952745,"url":"https://github.com/yoyoberenguer/rgb-split","last_synced_at":"2025-10-06T20:49:04.082Z","repository":{"id":133927432,"uuid":"212774739","full_name":"yoyoberenguer/RGB-split","owner":"yoyoberenguer","description":"RGB split effect ","archived":false,"fork":false,"pushed_at":"2020-01-19T20:00:56.000Z","size":441,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-08T04:33:10.898Z","etag":null,"topics":["channels","image-processing","rgb","rgb-split"],"latest_commit_sha":null,"homepage":null,"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/yoyoberenguer.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}},"created_at":"2019-10-04T08:58:48.000Z","updated_at":"2020-01-24T20:21:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7da7e07-dcf1-42c3-a27e-fee243dbb10b","html_url":"https://github.com/yoyoberenguer/RGB-split","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yoyoberenguer/RGB-split","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyoberenguer%2FRGB-split","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyoberenguer%2FRGB-split/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyoberenguer%2FRGB-split/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyoberenguer%2FRGB-split/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yoyoberenguer","download_url":"https://codeload.github.com/yoyoberenguer/RGB-split/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yoyoberenguer%2FRGB-split/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278678263,"owners_count":26027049,"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-10-06T02:00:05.630Z","response_time":65,"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":["channels","image-processing","rgb","rgb-split"],"created_at":"2025-04-03T00:31:29.536Z","updated_at":"2025-10-06T20:49:04.048Z","avatar_url":"https://github.com/yoyoberenguer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RGB-split\nRGB split effect \n\n![alt text](https://github.com/yoyoberenguer/RGB-split/blob/master/im160x360.png)\n![alt text](https://github.com/yoyoberenguer/RGB-split/blob/master/splitRGB.png)\n\n```\nSplit R, G, B channels from a PNG file (loaded with pygame)\n\n## BELOW CYTHON CODE \n\n# Returns separate channels R, G, B with per-pixel information\n# Use pygame special_flags pygame.BLEND_RGB_ADD\n# when bliting channels to your display (additive mode)\ndef rgb_split_channels_alpha(surface_: pygame.Surface):\n    return rgb_split_channels_alpha_c(surface_)\n\n@cython.boundscheck(False)\n@cython.wraparound(False)\n@cython.nonecheck(False)\ncdef rgb_split_channels_alpha_c(surface_: pygame.Surface):\n\n    assert isinstance(surface_, pygame.Surface), \\\n        '\\nPositional argument surface_ must be a pygame.Surface, got %s ' % type(surface_)\n    if surface_.get_width() == 0 or surface_.get_height() == 0:\n        raise ValueError('\\nIncorrect pixel size or wrong format.'\n                         '\\nsurface_ dimensions (width, height) cannot be null.')\n    try:\n        alpha_array = pygame.surfarray.pixels_alpha(surface_)\n    except ValueError:\n        # unsupported colormasks for alpha reference array\n        print('\\nUnsupported colormasks for alpha reference array.')\n        raise ValueError('\\nMake sure the surface_ contains per-pixel alpha transparency values.')\n\n    width, height = surface_.get_size()\n    zeros = numpy.zeros((height, width, 4), dtype=numpy.uint8)\n    cdef:\n        int w = width\n        int h = height\n        unsigned char [:, :, :] red_s = zeros\n        unsigned char [:, :, :] green_s  = zeros.copy()\n        unsigned char [:, :, :] blue_s = zeros.copy()\n        unsigned char [:, :] red = pygame.surfarray.pixels_red(surface_)\n        unsigned char [:, :] green = pygame.surfarray.pixels_green(surface_)\n        unsigned char [:, :] blue = pygame.surfarray.pixels_blue(surface_)\n        unsigned char [:, :] alpha = alpha_array\n        unsigned char a\n    # RED CHANNEL\n    for i in range(w):\n        for j in range(h):\n          a = alpha[i, j]\n          red_s[j, i, 0], red_s[j, i, 1], red_s[j, i, 2], red_s[j, i, 3] = red[i, j], 0, 0, a\n          green_s[j, i, 0], green_s[j, i, 1], green_s[j, i, 2], green_s[j, i, 3] = 0, green[i, j], 0, a\n          blue_s[j, i, 0], blue_s[j, i, 1], blue_s[j, i, 2], blue_s[j, i, 3] = 0, 0, blue[i, j], a\n          \n    return pygame.image.frombuffer(red_s, (w, h), 'RGBA'),\\\n           pygame.image.frombuffer(green_s, (w, h), 'RGBA'),\\\n           pygame.image.frombuffer(blue_s, (w, h), 'RGBA')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoyoberenguer%2Frgb-split","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoyoberenguer%2Frgb-split","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoyoberenguer%2Frgb-split/lists"}