{"id":20471298,"url":"https://github.com/robertkist/py_dds","last_synced_at":"2026-05-27T20:32:06.641Z","repository":{"id":190112909,"uuid":"681971902","full_name":"robertkist/py_dds","owner":"robertkist","description":"A loader for .DDS files for Python 3.9 and newer, written in pure Python","archived":false,"fork":false,"pushed_at":"2023-08-23T07:08:18.000Z","size":997,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T13:46:01.090Z","etag":null,"topics":["dds","dxt","dxt5","graphics","python3"],"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/robertkist.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}},"created_at":"2023-08-23T06:50:36.000Z","updated_at":"2024-11-17T21:06:42.000Z","dependencies_parsed_at":"2023-08-23T09:25:43.169Z","dependency_job_id":null,"html_url":"https://github.com/robertkist/py_dds","commit_stats":null,"previous_names":["robertkist/py_dds"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/robertkist/py_dds","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertkist%2Fpy_dds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertkist%2Fpy_dds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertkist%2Fpy_dds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertkist%2Fpy_dds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertkist","download_url":"https://codeload.github.com/robertkist/py_dds/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertkist%2Fpy_dds/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33583394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"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":["dds","dxt","dxt5","graphics","python3"],"created_at":"2024-11-15T14:15:41.131Z","updated_at":"2026-05-27T20:32:06.626Z","avatar_url":"https://github.com/robertkist.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyDDS\n\npyDDS is a loader for .DDS files for Python 3.9 and newer. It's a pure Python package without any external\nruntime dependencies.\n\nSupported texture formats:\n- \n- BC1 with (DXT1a) and without alpha (DXT1c)\n- BC2 (DXT2 / DXT3)\n- BC3 (DXT4 / DXT5)\n- DX10 BC1\n- DX10 BC2\n- DX10 BC3\n- uncompressed, with (32bpp) and without alpha (24bpp)\n\nNotes:\n- Only 2D textures are supported. No volume textures and no cube maps.\n- With the exception of Uncompressed 24 bit images, all images have an alpha channel. However this alpha channel may be \n  completely set to opaque. In tha case of DXT1 there is also no distinction in the format between DXT1a and DXT1c with\n  many encoders, so this info has to be gotten from elsewhere (e.g. from a file naming convention).\n  In practical terms, this means that unless you're dealing with a Uncompressed 24bpp image, assume that it has an alpha channel.\n  Of course, you're free to discard the alpha information at your own discretion.\n- Example DDS files can be found in the `example_images` folder.\n- An example for loading and displaying a DDS image using Qt can be found in the `examples` folder\n  (make sure to have PySide6 installed)\n\n## Usage\n\nImporting the package and loading an image:\n```python\nimport py_dds\n\ntry:\n    dds = py_dds.DDSImage(\"foo.dds\")\nexcept py_dds.DDSException as e:\n    print(e)\n```\n\nGetting the image properties:\n```python\nwidth: int = dds.width(mip=0)  # get width for Mip map 0 (the largest Mip map)\nheight: int = dds.height(mip=0)  # get height for Mip map 0\nnumber_of_mip_maps: int = dds.mip_count()\ndds_format: py_dds.DDSFormat = dds.format()\n```\nMethods which require a `mip=` input to choose a mip map will raise an `IndexError` if an invalid\nmip map has been specified.\n\nInterpreting the file format: The DDSFormat is an enum which can be used to check the compression used. The DDSFormat enum is defined such:\n```python\nclass DDSFormat(Enum):\n    \"\"\"supported DDS formats, including DX9 and DX10 formats\"\"\"\n    DXT1 = \"DXT1\"  # includes DXT1a, DXT1c\n    DXT3 = \"DXT3\"  # includes DXT2, DXT3\n    DXT5 = \"DXT5\"  # includes DXT3, DXT4\n    UNCOMPRESSED32 = \"UNCOMPRESSED32\"\n    UNCOMPRESSED24 = \"UNCOMPRESSED24\"\n    DXGI_FORMAT_BC1_UNORM_SRGB = \"DXGI_FORMAT_BC1_UNORM_SRGB\"\n    DXGI_FORMAT_BC2_UNORM_SRGB = \"DXGI_FORMAT_BC2_UNORM_SRGB\"\n    DXGI_FORMAT_BC3_UNORM_SRGB = \"DXGI_FORMAT_BC3_UNORM_SRGB\"\n```\n\nGetting a specific mip map from the image:\n```python\ndef set_pixel_callback(x: int, y: int, r: int, g: int, b: int, a: int) -\u003e None:\n    \"\"\"\n    :param x: X coordinate\n    :param y: Y coordinate\n    :param r: sRGB Red (0 - 255)\n    :param g: sRGB Green (0 - 255)\n    :param b: sRGB Blue (0 - 255)\n    :param a: Alpha (0 - 255)\n    \"\"\"\n    # insert your own code here to draw to e.g. a byte buffer, a QImage, a PIL image, etc.\n\ndds.draw(set_pixel_callback=set_pixel_callback, mip=0)  # draws Mip map 0 via the specified callback\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertkist%2Fpy_dds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertkist%2Fpy_dds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertkist%2Fpy_dds/lists"}