aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/css/image-orientation/index.html
blob: 7366e9755b92c5c1764d96ec4e06768506935c5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
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
---
<p><span class="seoSummary"><strong><code>image-orientation</code></strong><a href="/ja/docs/Web/CSS">CSS</a> のプロパティで、画像の向きのレイアウトに依存しない修正を指定します。</span>向きの調整以外に使用しては<em>いけません</em>。そのような場合は、 {{cssxref("transform")}} プロパティで <code>rotate</code> {{cssxref("&lt;transform-function&gt;")}} の値を使用してください。</p>

<div class="warning">
<p><strong>警告:</strong> このプロパティは仕様書で非推奨となっています。この機能は {{HTMLElement("img")}}{{HTMLElement("picture")}} 要素のプロパティに、おそらく <code>from-image</code> の例外を除いて移行する可能性があります。 <code>flip</code> および <code>&lt;angle&gt;</code> の値は Firefox 63 で廃止されました。</p>
</div>

<pre class="brush:css no-line-numbers">/* キーワード値 */
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; /* 回転せず、水平方向の反転のみ適用 */</pre>

<p>{{cssinfo}}</p>

<h2 id="Syntax" name="Syntax">構文</h2>

<h3 id="Values" name="Values"></h3>

<dl>
 <dt><code>none</code></dt>
 <dd>既定の初期値です。追加の画像の回転を適用しません。画像はエンコードされた方向、または他の CSS プロパティの値で決められた方向になります。</dd>
 <dt><code>from-image</code></dt>
 <dd>画像に含まれている {{interwiki("wikipedia", "EXIF")}} 情報を使用して、画像の向きを適切にします。</dd>
 <dt>{{cssxref("&lt;angle&gt;")}} {{non-standard_inline}}{{obsolete_inline(63)}}</dt>
 <dd>画像を回転させる {{cssxref("&lt;angle&gt;")}}。 もっとも近い <code>90deg</code> (<code>0.25turn</code>) 単位の値に丸められます。</dd>
 <dt><code>flip</code> {{non-standard_inline}}{{obsolete_inline(63)}}</dt>
 <dd>{{cssxref("&lt;angle&gt;")}} 値に従って回転した後に、画像を水平方向に反転します (つまり鏡像にします)。 {{cssxref("&lt;angle&gt;")}} を指定しない場合は、 <code>0deg</code> を使用します。</dd>
</dl>

<h3 id="Formal_syntax" name="Formal_syntax">形式文法</h3>

{{csssyntax}}

<h2 id="Usage_notes" name="Usage_notes">使用上のメモ</h2>

<p>このプロパティは、回転したカメラで撮影された画像の方向を修正するため<em>だけ</em>を目的としています。自由に回転させるために使用するべきでは<em>ありません</em>。撮影やスキャンで回転してしまった画像の向きを修正する以外の用途の場合は、 {{cssxref("transform")}} プロパティに <code>rotate</code> キーワードを付けて回転を指定してください。これはユーザーによる画像の向きの変更や、印刷時に縦向きと横向きを変更する必要がある場合も含みます。</p>

<p>{{cssxref("&lt;transform-function&gt;")}} などの他の CSS プロパティとの組み合わせで使用された場合、 <code>image-orientation</code> による回転は、常に他の変形が行われる前に適用されます。</p>

<h2 id="Example" name="Example"></h2>

<h3 id="CSS">CSS</h3>

<pre class="brush: css">#image {
  image-orientation: from-image; /* ライブ例の中で変更することができます */
}
</pre>

<div class="hidden">
<h3 id="HTML">HTML</h3>

<pre class="brush: html">&lt;img id="image" src="https://mdn.mozillademos.org/files/12668/MDN.svg"
    alt="Orientation taken from the image"&gt;
&lt;select id="imageOrientation"&gt;
  &lt;option value="from-image"&gt;from-image&lt;/option&gt;
  &lt;option value="none"&gt;none&lt;/option&gt;
&lt;/select&gt;
</pre>

<h3 id="JavaScript">JavaScript</h3>

<pre class="brush: js">var imageOrientation = document.getElementById("imageOrientation");
imageOrientation.addEventListener("change", function (evt) {
  document.getElementById("image").style.imageOrientation = evt.target.value;
});
</pre>
</div>

<h3 id="Result" name="Result">結果</h3>

<p>{{EmbedLiveSample("Example", "100%", 240)}}</p>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
   <th scope="col">状態</th>
   <th scope="col">備考</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Images', '#the-image-orientation', 'image-orientation')}}</td>
   <td>{{Spec2('CSS3 Images')}}</td>
   <td>初回定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

<p>{{Compat("css.properties.image-orientation")}}</p>

<h2 id="See_also" name="See_also">関連情報</h2>

<ul>
 <li>ほかの画像関連 CSS プロパティ: {{cssxref("object-fit")}}, {{cssxref("object-position")}}, {{cssxref("image-orientation")}}, {{cssxref("image-rendering")}}, {{cssxref("image-resolution")}}</li>
 <li>{{cssxref("transform")}} および {{cssxref("rotate")}}</li>
</ul>

<div>{{CSSRef}}</div>