※2018/05/27 現在の情報です
前提
以下、例として用いる Twitter のアカウントは @KONAMI573ch
とします。
Twitter の「プロフィールバナー画像」
Twitter における「プロフィールバナー画像」とは、以下の部分の画像を指します(PC版の公式ページより)。
画像の URL(サイズ)は 9種類 ある
上記の画像のサイズは内部的に 9種類 あり、それぞれに URL が存在します。公式のドキュメント に書いてあることですが、まとめておきます。
画像サイズ | サイズの別称 | URL |
---|---|---|
1500x500 | なし | https://pbs.twimg.com/profile_banners/150552419/1526263159/1500x500 |
600x200 | なし | https://pbs.twimg.com/profile_banners/150552419/1526263159/600x200 |
300x100 | なし | https://pbs.twimg.com/profile_banners/150552419/1526263159/300x100 |
520x260 | web | https://pbs.twimg.com/profile_banners/150552419/1526263159/web |
1040x520 | web_retina | https://pbs.twimg.com/profile_banners/150552419/1526263159/web_retina |
626x313 | ipad | https://pbs.twimg.com/profile_banners/150552419/1526263159/ipad |
1252x626 | ipad_retina | https://pbs.twimg.com/profile_banners/150552419/1526263159/ipad_retina |
320x160 | mobile | https://pbs.twimg.com/profile_banners/150552419/1526263159/mobile |
640x320 | mobile_retina | https://pbs.twimg.com/profile_banners/150552419/1526263159/mobile_retina |
備考
- 9種類もの画像サイズがあるのはデバイスに応じて適切な容量の画像を返すためでしょう
- 単純に画像を保存したいということであれば
1500x500
を選んでおけばよいと思います - 「サイズの別称」が存在する画像のアスペクト比は
2:1
で、そうでない種別は3:1
です- アスペクト比が
2:1
の画像は3:1
の画像をクロップしたものです
- アスペクト比が
- 画像の URL は永続的ではなく、画像が変更されるたびに変わります
- 本記事の内容は REST API の仕様をもとに書いています