How to guess image mime type?

后端 未结 3 714
感动是毒
感动是毒 2020-12-11 06:41

How can I guess an image\'s mime type, in a cross-platform manner, and without any external libraries?

3条回答
  •  无人及你
    2020-12-11 07:22

    If you can rely on the file extension you can use the mimetypes.guess_type function. Note that you may get different results on different platforms, but I would still call it cross-platform.

提交回复
热议问题