{"id":19212769,"url":"https://github.com/robert-ancell/pygif","last_synced_at":"2025-05-12T20:40:15.541Z","repository":{"id":62580653,"uuid":"159306389","full_name":"robert-ancell/pygif","owner":"robert-ancell","description":"Python encoder and decoder for the GIF file format.","archived":false,"fork":false,"pushed_at":"2023-10-17T09:14:47.000Z","size":326,"stargazers_count":12,"open_issues_count":6,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-20T17:40:41.566Z","etag":null,"topics":["gif","python-library"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robert-ancell.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,"zenodo":null}},"created_at":"2018-11-27T09:04:44.000Z","updated_at":"2024-08-16T09:19:19.000Z","dependencies_parsed_at":"2025-04-20T17:34:47.594Z","dependency_job_id":"1c769a59-1cfe-47fe-946d-e67d80142a96","html_url":"https://github.com/robert-ancell/pygif","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-ancell%2Fpygif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-ancell%2Fpygif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-ancell%2Fpygif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-ancell%2Fpygif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robert-ancell","download_url":"https://codeload.github.com/robert-ancell/pygif/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253817732,"owners_count":21969031,"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":["gif","python-library"],"created_at":"2024-11-09T13:48:42.500Z","updated_at":"2025-05-12T20:40:15.496Z","avatar_url":"https://github.com/robert-ancell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repository contains a Python encoder and decoder for the [GIF file format](https://www.w3.org/Graphics/GIF/spec-gif89a.txt).\n\nThe easiest way to get PyGIF is to install from the [Python Packaging Index](https://pypi.org/project/pygif/):\n```\npip install pygif\n```\n\nThe following will generate an 8x8 checkerboard image:\n```python\nimport gif\n\nwriter = gif.Writer (open ('checkerboard.gif', 'wb'))\nwriter.write_header ()\nwriter.write_screen_descriptor (8, 8, has_color_table = True, depth = 1)\nwriter.write_color_table ([(0, 0, 0), (255, 255, 255)], 1)\nwriter.write_image (8, 8, 1, [ 1, 0, 1, 0, 1, 0, 1, 0,\n                               0, 1, 0, 1, 0, 1, 0, 1,\n                               1, 0, 1, 0, 1, 0, 1, 0,\n                               0, 1, 0, 1, 0, 1, 0, 1,\n                               1, 0, 1, 0, 1, 0, 1, 0,\n                               0, 1, 0, 1, 0, 1, 0, 1,\n                               1, 0, 1, 0, 1, 0, 1, 0,\n                               0, 1, 0, 1, 0, 1, 0, 1 ])\nwriter.write_trailer ()\n```\n\nThe following will decode that image:\n```python\nimport gif\n\nfile = open ('checkerboard.gif', 'rb')\nreader = gif.Reader ()\nreader.feed (file.read ())\nif reader.has_screen_descriptor ():\n    print ('Size: %dx%d' % (reader.width, reader.height))\n    print ('Colors: %s' % repr (reader.color_table))\n    for block in reader.blocks:\n        if isinstance (block, gif.Image):\n            print ('Pixels: %s' % repr (block.get_pixels ()))\n    if reader.has_unknown_block ():\n        print ('Encountered unknown block')\n    elif not reader.is_complete ():\n        print ('Missing trailer')\nelse:\n    print ('Not a valid GIF file')\n```\n\nGiving the following output:\n```\nSize: 8x8\nColors: [(0, 0, 0), (255, 255, 255)]\nPixels: [1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-ancell%2Fpygif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobert-ancell%2Fpygif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-ancell%2Fpygif/lists"}