file in abyss
フォーマット一覧へ戻る

Image

BMP Windows Bitmap

Windowsで古くから使われるラスター画像形式。先頭のBMに続いてDIBヘッダが入ります。

Extensions .bmp, .dib
MIME image/bmp, image/x-ms-bmp

マジックナンバー

ファイルを解析
オフセット 0 Bitmap file header
42 4D
BM

構造

  1. Bitmap file header
  2. DIB header
  3. Optional color table
  4. Pixel array

注意点

  • BMPには複数のDIBヘッダ種類があり、圧縮方式もヘッダ内で変わります。

判定コード例

SIGNATURE = bytes.fromhex("424d")
OFFSET = 0

def is_bmp(path: str) -> bool:
    with open(path, "rb") as f:
        f.seek(OFFSET)
        head = f.read(len(SIGNATURE))
    return head == SIGNATURE

実践的な使い方

ユースケース

Windows Bitmap は画像のプレビュー、サムネイル、メタデータ確認、アップロード検証などで広く使われます。解像度・アルファ・圧縮・ファイルサイズが実装の挙動に影響するため、複数のサイズでテストしてください。

よくある判定ミス

  • .bmp / .dib という拡張子だけではファイルの中身を保証できません。アップロードや変換の処理では、拡張子・MIMEタイプ・先頭バイト・形式固有の構造チェックを組み合わせるべきです。
  • Windows Bitmap は 42 4D のようなシグネチャで始まりますが、関連するコンテナや破損ファイルでは追加の検証が必要になる場合があります。

セキュリティ上の注意

メディアファイルも、壊れたメタデータ・極端な寸法・長い再生時間・異常なチャンクでデコーダに負荷をかけることがあります。処理前にサイズ・寸法・長さを読み取ってください。

サンプルの活用

11 個のサンプルで、極小画像・高解像度画像・アルファチャンネル・圧縮しにくいアセットをテストできます。

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
Flower Garden BMP preview

Flower Garden BMP

Flower Garden BMP is a Windows Bitmap sample based on Wikimedia Commons, 960 x 540. It can be used to test downloads, parsers, previews, and file type detection.

flower-garden.bmp
Resolution 960 x 540 518 Kpx
PreviewLarge file
1.48 MB
SHA-256 20168aa7ce4606e585704083cd724df1125fa00393a9544253a67b420c501c11
Download
Blue Sky BMP preview

Blue Sky BMP

Blue Sky BMP is a Windows Bitmap sample based on Wikimedia Commons, 96 x 72. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.bmp
Resolution 96 x 72 7 Kpx
Preview
20 KB
SHA-256 4eb92e5e90fe8f5db763d86c90e5edbbedb528f74da8e86d7df3d9f86e8a97b4
Download
Flower Garden BMP preview

Flower Garden BMP

Flower Garden BMP is a Windows Bitmap sample based on Wikimedia Commons, 160 x 90. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.bmp
Resolution 160 x 90 14 Kpx
Preview
42 KB
SHA-256 ab2ba06de24e5e14216b7776893ed83553effd903885322b3001e352848f1f91
Download
Navy Blue Sky BMP preview

Navy Blue Sky BMP

Navy Blue Sky BMP is a Windows Bitmap sample based on Wikimedia Commons, 256 x 128. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.bmp
Resolution 256 x 128 33 Kpx
Preview
96 KB
SHA-256 bf2979e754d0dc037ca38069660421dcbe0242d259a561536b6d9ae1faf1f1e2
Download
Nature of the Sky BMP preview

Nature of the Sky BMP

Nature of the Sky BMP is a Windows Bitmap sample based on Wikimedia Commons, 360 x 270. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.bmp
Resolution 360 x 270 97 Kpx
Preview
285 KB
SHA-256 ee8aec450b9063e52f737c7c925e0110ec83b608b1d4cb5eda95452a33667f3a
Download
Sky Landscape BMP preview

Sky Landscape BMP

Sky Landscape BMP is a Windows Bitmap sample based on Wikimedia Commons, 512 x 384. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.bmp
Resolution 512 x 384 197 Kpx
Preview
576 KB
SHA-256 b31a1aa2677aa0e8d9d03f898f02345a3c09f5fa052d6130c5e3e40c1bb8d7e1
Download
Starry Sky BMP preview

Starry Sky BMP

Starry Sky BMP is a Windows Bitmap sample based on Wikimedia Commons, 720 x 480. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.bmp
Resolution 720 x 480 346 Kpx
Preview
1013 KB
SHA-256 9a906ff6465e7e95dac75ec3e668c7bb3a5ef49d7e47fa78e71e118f8ac80e9a
Download
Blue Night Sky BMP preview

Blue Night Sky BMP

Blue Night Sky BMP is a Windows Bitmap sample based on Wikimedia Commons, 960 x 640. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.bmp
Resolution 960 x 640 614 Kpx
PreviewLarge file
1.76 MB
SHA-256 24e10e169c35cae48959735dd2e22c4efeda4af70920610dc5338e878da71d88
Download
Hibiscus Flower BMP preview

Hibiscus Flower BMP

Hibiscus Flower BMP is a Windows Bitmap sample based on Wikimedia Commons, 1280 x 2770. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.bmp
Resolution 1280 x 2770 3.5 MP
High resLarge file
10.14 MB
SHA-256 f5ab30cd048fb4d6bd169d3becf00c821285119117d07120bc54ce29ec2fded2
Download
Arctic Sky BMP preview

Arctic Sky BMP

Arctic Sky BMP is a Windows Bitmap sample based on Wikimedia Commons, 1600 x 1062. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.bmp
Resolution 1600 x 1062 1.7 MP
PreviewLarge file
4.86 MB
SHA-256 6beb2e836570ddae27e5cc19ae84dd5da2dd0f9b997bbf473ebb810e0313e256
Download
NASA Blue Marble BMP preview

NASA Blue Marble BMP

NASA Blue Marble BMP is a Windows Bitmap sample based on NASA Image and Video Library, 640 x 640. It can be used to test downloads, parsers, previews, and file type detection.

nasa-blue-marble-2012-east.bmp
Resolution 640 x 640 410 Kpx
PreviewLarge file
1.17 MB
SHA-256 4ef15ea61207fb39f3e456260d2571036f2214a352c24bde8badae69cef49e74
Download

よくある質問

Windows Bitmap のマジックナンバー(ファイルシグネチャ)は?

Windows Bitmap ファイルはバイトシグネチャ 42 4D ("BM") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

Windows Bitmap のMIMEタイプは?

Windows Bitmap のMIMEタイプは image/bmp, image/x-ms-bmp です。

Windows Bitmap の拡張子は?

Windows Bitmap ファイルは .bmp, .dib 拡張子を使います。拡張子は慣習にすぎず中身を保証しないため、シグネチャや構造のチェックと組み合わせてください。

関連フォーマット