{"id":28469774,"url":"https://github.com/answerdotai/imghdr2","last_synced_at":"2026-02-05T13:31:35.731Z","repository":{"id":236882401,"uuid":"793345888","full_name":"AnswerDotAI/imghdr2","owner":"AnswerDotAI","description":"imghdr from python stdlib","archived":false,"fork":false,"pushed_at":"2024-04-29T04:24:55.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-02T07:29:57.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnswerDotAI.png","metadata":{"files":{"readme":"README.rst","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":"2024-04-29T03:36:31.000Z","updated_at":"2024-04-29T06:44:00.000Z","dependencies_parsed_at":"2024-04-29T04:41:41.167Z","dependency_job_id":null,"html_url":"https://github.com/AnswerDotAI/imghdr2","commit_stats":null,"previous_names":["answerdotai/imghdr2","answerdotai/imghdr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AnswerDotAI/imghdr2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fimghdr2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fimghdr2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fimghdr2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fimghdr2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnswerDotAI","download_url":"https://codeload.github.com/AnswerDotAI/imghdr2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Fimghdr2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29122607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T10:47:47.471Z","status":"ssl_error","status_checked_at":"2026-02-05T10:45:08.119Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-06-07T09:08:33.973Z","updated_at":"2026-02-05T13:31:35.712Z","avatar_url":"https://github.com/AnswerDotAI.png","language":"Python","readme":":mod:`imghdr2` --- Determine the type of an image\n\n--------------\n\nThe :mod:`imghdr2` module determines the type of image contained in a file or\nbyte stream. It was originally ``imghdr`` in the Python standard library, but is now\ndeprecated. This module is a drop-in replacement for the original, with the same API.\n\nInstall with ``pip install imghdr2``.\n\nThe :mod:`imghdr2` module defines the following function:\n\n\n.. function:: what(file, h=None)\n\n   Tests the image data contained in the file named by *file*, and returns a\n   string describing the image type.  If optional *h* is provided, the *file*\n   argument is ignored and *h* is assumed to contain the byte stream to test.\n\nThe following image types are recognized, as listed below with the return value\nfrom :func:`what`:\n\n+------------+-----------------------------------+\n| Value      | Image format                      |\n+============+===================================+\n| ``'rgb'``  | SGI ImgLib Files                  |\n+------------+-----------------------------------+\n| ``'gif'``  | GIF 87a and 89a Files             |\n+------------+-----------------------------------+\n| ``'pbm'``  | Portable Bitmap Files             |\n+------------+-----------------------------------+\n| ``'pgm'``  | Portable Graymap Files            |\n+------------+-----------------------------------+\n| ``'ppm'``  | Portable Pixmap Files             |\n+------------+-----------------------------------+\n| ``'tiff'`` | TIFF Files                        |\n+------------+-----------------------------------+\n| ``'rast'`` | Sun Raster Files                  |\n+------------+-----------------------------------+\n| ``'xbm'``  | X Bitmap Files                    |\n+------------+-----------------------------------+\n| ``'jpeg'`` | JPEG data in JFIF or Exif formats |\n+------------+-----------------------------------+\n| ``'bmp'``  | BMP files                         |\n+------------+-----------------------------------+\n| ``'png'``  | Portable Network Graphics         |\n+------------+-----------------------------------+\n| ``'webp'`` | WebP files                        |\n+------------+-----------------------------------+\n| ``'exr'``  | OpenEXR Files                     |\n+------------+-----------------------------------+\n\n\nYou can extend the list of file types :mod:`imghdr2` can recognize by appending\nto ``tests``. It is a list of functions performing the individual tests.  Each function takes two\narguments: the byte-stream and an open file-like object. When :func:`what` is\ncalled with a byte-stream, the file-like object will be ``None``.\nThe test function should return a string describing the image type if the test\nsucceeded, or ``None`` if it failed.\n\nExample::\n\n   \u003e\u003e\u003e import imghdr2\n   \u003e\u003e\u003e imghdr2.what('bass.gif')\n   'gif'\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanswerdotai%2Fimghdr2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanswerdotai%2Fimghdr2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanswerdotai%2Fimghdr2/lists"}