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

Image

SVG Scalable Vector Graphics

XMLベースのベクター画像形式。テキストとして読め、ブラウザで直接表示できます。

Extensions .svg
MIME image/svg+xml

マジックナンバー

ファイルを解析
オフセット 0 SVG root element at file start
3C 73 76 67
<svg
オフセット 0 XML declaration before SVG root
3C 3F 78 6D 6C
<?xml

構造

  1. Optional XML declaration
  2. svg root element
  3. Shapes
  4. Styles
  5. Metadata

注意点

  • SVGはスクリプトや外部参照を含められるため、表示前に安全性を確認する必要があります。

判定コード例

SIGNATURE = bytes.fromhex("3c737667")
OFFSET = 0

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

実践的な使い方

ユースケース

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

よくある判定ミス

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

セキュリティ上の注意

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

サンプルの活用

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

サンプルファイル

11 / 11 files
Sample Traits Size Source / license / SHA-256
Soft Sky SVG preview

Soft Sky SVG

Soft Sky SVG is a Scalable Vector Graphics sample generated for file format testing, 640 x 360. It can be used to test downloads, parsers, previews, and file type detection.

soft-sky.svg
Resolution 640 x 360 230 Kpx
PreviewSmall file
526 B
Generated CC0 1.0
SHA-256 04300b35b7d89fa0aa68e95ab63dac29a53438cb8c111d088d4f0b0d5461c40f
Download
Blue Sky SVG preview

Blue Sky SVG

Blue Sky SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 64 x 64. It can be used to test downloads, parsers, previews, and file type detection.

01-blue-sky.svg
Resolution 64 x 64 4 Kpx
TinySmall file
658 B
SHA-256 d354cdd8ca8a36f09a6b412b5b6f2603c69a09a95796e9065069a9a8e3e19c7d
Download
Flower Garden SVG preview

Flower Garden SVG

Flower Garden SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 128 x 72. It can be used to test downloads, parsers, previews, and file type detection.

02-flower-garden.svg
Resolution 128 x 72 9 Kpx
PreviewSmall file
669 B
SHA-256 c92ee56b9ed9ceb6c2f4ac18f838fe80d70b215d2ef062f4e0b7821c7b012ba8
Download
Navy Blue Sky SVG preview

Navy Blue Sky SVG

Navy Blue Sky SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 256 x 144. It can be used to test downloads, parsers, previews, and file type detection.

03-navy-blue-sky.svg
Resolution 256 x 144 37 Kpx
PreviewSmall file
682 B
SHA-256 6791490033e987b6e80fcc787fbb2cf76f5b871c9ec85da40401d9dbc1d72c3d
Download
Nature of the Sky SVG preview

Nature of the Sky SVG

Nature of the Sky SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 360 x 640. It can be used to test downloads, parsers, previews, and file type detection.

04-nature-sky.svg
Resolution 360 x 640 230 Kpx
PreviewSmall file
688 B
SHA-256 c706c311f90100386a398190a5c87ff625da1d18fdfcebd12d1755f171b5c07d
Download
Sky Landscape SVG preview

Sky Landscape SVG

Sky Landscape SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 640 x 360. It can be used to test downloads, parsers, previews, and file type detection.

05-sky-landscape.svg
Resolution 640 x 360 230 Kpx
PreviewSmall file
685 B
SHA-256 527425180e0137305b115b812658007ad012718772d3ceed6c4a6e1365801813
Download
Starry Sky SVG preview

Starry Sky SVG

Starry Sky SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 800 x 600. It can be used to test downloads, parsers, previews, and file type detection.

06-starry-sky.svg
Resolution 800 x 600 480 Kpx
PreviewSmall file
683 B
SHA-256 b9d8b6026d5115e46ef1131d7a8f5d6792208ef4d61302892c5ab7cb8f2ffb36
Download
Blue Night Sky SVG preview

Blue Night Sky SVG

Blue Night Sky SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 1024 x 768. It can be used to test downloads, parsers, previews, and file type detection.

07-blue-night-sky.svg
Resolution 1024 x 768 786 Kpx
PreviewSmall file
692 B
SHA-256 747fea89e431864c83b5a614dd885ca38574ddbb03f9f9b84334dc8113c6a984
Download
Hibiscus Flower SVG preview

Hibiscus Flower SVG

Hibiscus Flower SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 1280 x 720. It can be used to test downloads, parsers, previews, and file type detection.

08-hibiscus-flower.svg
Resolution 1280 x 720 922 Kpx
PreviewSmall file
694 B
SHA-256 c18770f0e9d692d815e99a89e6ab2f9beaaa3913847d1d5d60becbc677c56335
Download
Arctic Sky SVG preview

Arctic Sky SVG

Arctic Sky SVG is a Scalable Vector Graphics sample based on Wikimedia Commons, 1600 x 900. It can be used to test downloads, parsers, previews, and file type detection.

09-arctic-sky.svg
Resolution 1600 x 900 1.4 MP
PreviewSmall file
690 B
SHA-256 ccaca49cab5b5a22d4c4d581a2a38a88ca3ab561e44dde9cddaf4bf435375485
Download
NASA Blue Marble Metadata SVG preview

NASA Blue Marble Metadata SVG

NASA Blue Marble Metadata SVG is a Scalable Vector Graphics sample based on NASA Image and Video Library, 640 x 360. It can be used to test downloads, parsers, previews, and file type detection.

nasa-blue-marble-2012-east.svg
Resolution 640 x 360 230 Kpx
PreviewSmall file
685 B
SHA-256 ee1de3cc3ccb1639c12b616324893b8a33a2f28aa1239b624fd45493f339c0b1
Download

よくある質問

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

Scalable Vector Graphics ファイルはバイトシグネチャ 3C 73 76 67 ("<svg") または 3C 3F 78 6D 6C ("<?xml") で始まります。拡張子に頼らず、この先頭バイトを読み取って形式を判定してください。

Scalable Vector Graphics のMIMEタイプは?

Scalable Vector Graphics のMIMEタイプは image/svg+xml です。

Scalable Vector Graphics の拡張子は?

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

関連フォーマット