Skip to content

Deprecation: imghdr module is being deprecated in Python 3.11 #3020

@harshil21

Description

@harshil21

The imghdr module is being deprected in 3.11 and will be removed in 3.13. See PEP 594 for details.

We currently use it only in one area:

image = imghdr.what(None, stream)

Alternatives would be:

  1. Just use the mimetype module? We were using only the mimetype module until @b83a659 where we used a 'hack' to detect the type from the byte stream. This was then replaced by the imghdr module which did the same thing better.
  2. Use a library called filetype to detect images. This was recommended by the PEP.
  3. Just copy the python source of the imghdr module into ours?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions