<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](sndhdr.xhtml "sndhdr --- 推測聲音文件的類型") | - [上一頁](colorsys.xhtml "colorsys --- Conversions between color systems") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) ? - zh\_CN 3.7.3 [文檔](../index.xhtml) ? - [Python 標準庫](index.xhtml) ? - [多媒體服務](mm.xhtml) ? - $('.inline-search').show(0); | # [`imghdr`](#module-imghdr "imghdr: Determine the type of image contained in a file or byte stream.") --- 推測圖像類型 **源代碼** [Lib/imghdr.py](https://github.com/python/cpython/tree/3.7/Lib/imghdr.py) \[https://github.com/python/cpython/tree/3.7/Lib/imghdr.py\] - - - - - - [`imghdr`](#module-imghdr "imghdr: Determine the type of image contained in a file or byte stream.") 模塊推測文件或字節流中的圖像的類型。 [`imghdr`](#module-imghdr "imghdr: Determine the type of image contained in a file or byte stream.") 模塊定義了以下類型: `imghdr.``what`(*filename*, *h=None*)測試包含在命名為 *filename* 的文件中的圖像數據,并且返回描述此類圖片的字符串。如果可選的 *h* 被提供, *filename* 將被忽略并且 *h* 包含將被測試的二進制流。 在 3.6 版更改: 接受一個 [類路徑對象](../glossary.xhtml#term-path-like-object)。 接下來的圖像類型是可識別的,返回值來自 [`what()`](#imghdr.what "imghdr.what"): 值 圖像格式 `'rgb'` SGI 圖像庫文件 `'gif'` GIF 87a 和 89a 文件 `'pbm'` 便攜式位圖文件 `'pgm'` 便攜式灰度圖文件 `'ppm'` 便攜式像素表文件 `'tiff'` TIFF 文件 `'rast'` Sun 光柵文件 `'xbm'` X 位圖文件 `'jpeg'` JFIF 或 Exif 格式的 JPEG 數據 `'bmp'` BMP 文件 `'png'` 便攜式網絡圖像 `'webp'` WebP 文件 `'exr'` OpenEXR 文件 3\.5 新版功能: *exr* 和 *webp* 格式被添加。 你可以擴展此 [`imghdr`](#module-imghdr "imghdr: Determine the type of image contained in a file or byte stream.") 可以被追加的這個變量識別的文件格式的列表: `imghdr.``tests`執行單個測試的函數列表。每個函數都有兩個參數:字節流和類似開放文件的對象。當 [`what()`](#imghdr.what "imghdr.what") 用字節流調用時,類文件對象將是 `None`。 如果測試陳工,這個測試函數應當返回一個描述圖像類型的字符串,否則返回 `None`。 示例: ``` >>> import imghdr >>> imghdr.what('bass.gif') 'gif' ``` ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](sndhdr.xhtml "sndhdr --- 推測聲音文件的類型") | - [上一頁](colorsys.xhtml "colorsys --- Conversions between color systems") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) ? - zh\_CN 3.7.3 [文檔](../index.xhtml) ? - [Python 標準庫](index.xhtml) ? - [多媒體服務](mm.xhtml) ? - $('.inline-search').show(0); | ? [版權所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 軟件基金會是一個非盈利組織。 [請捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [發現了問題](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 創建。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看