Webサイト制作において見かけるSVGというワード。
SVG(Scalable Vector Graphics)とは、XMLベースのマークアップ言語を使用してベクター画像を表現するファイルフォーマットです。解像度に依存せず、拡大や縮小をしても画質が劣化しないのが特徴で、ロゴやアイコン、グラフ、イラストなどのデザインによく用いられます。
SVGは、直線や曲線、テキスト、パス、シェイプなどを数値で定義することで描画されますが、JPEGやPNGなどピクセル単位のラスター画像とは異なり、SVGは数式を元にレンダリングされるため、どのサイズでも鮮明に表示できます。
またテキストとして記述されるため、コードの編集や検索、圧縮がしやすく、ウェブ開発に適しています。
SVGはHTMLやCSS、JavaScriptと連携しやすく、動的なデザインやアニメーションの実装にも活用可能。CSSを使えば色や線の太さを変更でき、JavaScriptを組み合わせることでインタラクティブなエフェクトを加えることもできます。ファイルサイズが軽量で、テキストエディタで簡単に編集できるというメリットもあります。
ただし、複雑な画像や写真のような表現には向いておらず、大量のパスデータを含むとファイルサイズが大きくなることがあります。適材適所でラスター画像と使い分けることで、より効果的に活用できるのでうまく使いこなしましょう。
The term “SVG” (Scalable Vector Graphics) is often encountered in web development.
SVG is a file format that uses an XML-based markup language to represent vector graphics. It is resolution-independent, meaning that it does not lose quality when scaled up or down. This makes it ideal for use in logos, icons, charts, and illustrations.
Unlike raster images such as JPEG or PNG, which are defined by pixels, SVG is rendered based on mathematical formulas. This ensures that it remains crisp and clear at any size.
Since SVG is written as text, it is easy to edit, search, and compress, making it particularly suitable for web development.
SVG integrates well with HTML, CSS, and JavaScript, allowing for dynamic designs and animations. With CSS, colors and stroke widths can be modified, while JavaScript enables interactive effects. Additionally, SVG files are lightweight and can be easily edited using a text editor.
However, SVG is not well-suited for complex images or photographic representations. If it contains a large number of path data points, the file size can become quite large. By strategically using both vector and raster images, SVG can be effectively leveraged for various design purposes.
株式会社ASAP
及川知也