<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kwnflog</author_name>
  <author_url>https://blog.hatena.ne.jp/kwnflog/</author_url>
  <blog_title>ホンモノのエンジニアになりたい</blog_title>
  <blog_url>https://www.engineer-log.com/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>タイトルの通り、imghdr.what()で画像ファイルのフォーマットを調べたら一部のJPEGファイルを上手く検出できない事象に遭遇しました。このエントリではこの問題の原因と対策として、調べてみたこと、やってみたことをまとめます。 はじめに Webアプリを作って遊んでいたときに、アップロードされた画像のファイル種別を判定しようとしていました。 そこでimghdr.what()を使ったのですが、どうもJPEGファイルなのに分岐にかからずに抜けてしまうファイルが存在することに気づきました。なんでやねん、なんでやねん、と頭をポカスカ叩きながら考えてもよくわからず、とりあえずググってみることに。 する…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.engineer-log.com%2Fentry%2F2018%2F12%2F30%2Fjpeg-python-imghdr&quot; title=&quot;【Python】imghdr.what()でJPEGファイルが判定できない。なぜ？ - ホンモノのエンジニアになりたい&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/k/kwnflog/20191114/20191114224718.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-12-30 17:38:05</published>
  <title>【Python】imghdr.what()でJPEGファイルが判定できない。なぜ？</title>
  <type>rich</type>
  <url>https://www.engineer-log.com/entry/2018/12/30/jpeg-python-imghdr</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
