--- title: image-orientation slug: Web/CSS/image-orientation tags: - CSS - CSS Image - CSS Property - CSS プロパティ - CSS 画像 - EXIF - Experimental - Reference - image-orientation - リファレンス - 画像の向き - 画像補正 translation_of: Web/CSS/image-orientation ---
image-orientation は CSS のプロパティで、画像の向きのレイアウトに依存しない修正を指定します。向きの調整以外に使用してはいけません。そのような場合は、 {{cssxref("transform")}} プロパティで rotate {{cssxref("<transform-function>")}} の値を使用してください。
警告: このプロパティは仕様書で非推奨となっています。この機能は {{HTMLElement("img")}} や {{HTMLElement("picture")}} 要素のプロパティに、おそらく from-image の例外を除いて移行する可能性があります。 flip および <angle> の値は Firefox 63 で廃止されました。
/* キーワード値 */
image-orientation: none;
image-orientation: from-image; /* 画像の EXIF データを使用 */
/* グローバル値 */
image-orientation: inherit;
image-orientation: initial;
image-orientation: unset;
/* 廃止された値 {{obsolete_inline(63)}} */
image-orientation: 90deg; /* 90度回転 */
image-orientation: 90deg flip; /* 90度回転して、水平方向に反転 */
image-orientation: flip; /* 回転せず、水平方向の反転のみ適用 */
{{cssinfo}}
nonefrom-image90deg (0.25turn) 単位の値に丸められます。flip {{non-standard_inline}}{{obsolete_inline(63)}}0deg を使用します。このプロパティは、回転したカメラで撮影された画像の方向を修正するためだけを目的としています。自由に回転させるために使用するべきではありません。撮影やスキャンで回転してしまった画像の向きを修正する以外の用途の場合は、 {{cssxref("transform")}} プロパティに rotate キーワードを付けて回転を指定してください。これはユーザーによる画像の向きの変更や、印刷時に縦向きと横向きを変更する必要がある場合も含みます。
{{cssxref("<transform-function>")}} などの他の CSS プロパティとの組み合わせで使用された場合、 image-orientation による回転は、常に他の変形が行われる前に適用されます。
#image {
image-orientation: from-image; /* ライブ例の中で変更することができます */
}
<img id="image" src="https://mdn.mozillademos.org/files/12668/MDN.svg"
alt="Orientation taken from the image">
<select id="imageOrientation">
<option value="from-image">from-image</option>
<option value="none">none</option>
</select>
var imageOrientation = document.getElementById("imageOrientation");
imageOrientation.addEventListener("change", function (evt) {
document.getElementById("image").style.imageOrientation = evt.target.value;
});
{{EmbedLiveSample("Example", "100%", 240)}}
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('CSS3 Images', '#the-image-orientation', 'image-orientation')}} | {{Spec2('CSS3 Images')}} | 初回定義 |
{{Compat("css.properties.image-orientation")}}