About this Blog

This Blog has English posts and Japanese posts. About Mac, iOS, Objective-C, and so on.


xcf.txtの日本語訳-1. BASIC DATA MODEL

This post is a personal translation of Henning Makholm's xcf.txt to Japanese. : Index here


It is recommended that a software developer who wants to take full
advantage of the XCF format be deeply familiar with GIMP at least
as a user. The following high-level overview is meant to help those
non-users who just need to extract pixel data from an XCF file get up
to speed.


In general an XCF file describes a stack of _layers_ and _channels_ on
a _canvas_, which is just an abstract rectangular viewport for the
layers and channels.

ざっくり言うと、XCFファイルは_canvas_上の、_layers_と_channels_の集まりについて記述しています。 _canvas_は、layerとchannelのための、仮想的な四角形の表示領域に過ぎません。


A layer is a named rectangular area of pixels which has a definite
position with respect to the canvas. A layer may extend beyond the
canvas or (more commonly) only cover some of it. Each pixel of the
layer has a color which is specified in one of three ways:


  RGB: Three intensity values for red, green, and blue additive color
     components, each on a scale from 0 to 255. The exact color space
     is not specified. GIMP displays image data directly on PC
     display hardware without any software correction, so in most
     cases the intensity values should be considered nonlinear samples
     that map to physical light intensities using a power function
     with an exponent ("gamma") of about 2.5. (This is how PC hardware
     commonly treat bit values in the video buffer, which incidentally
     also has the property of making each 1/255th step about equally
     perceptible to the human eye when the monitor is correctly
     Beware, however, that GIMP's compositing algorithms (as
     described in Section 8 below) implicitly treat the intensities
     as _linear_ samples. The XCF file format currently has no support
     for storing the intended gamma of the samples.


  Grayscale: One intensity value on a scale from 0 (black) to 255
     (white). Gamma considerations as for RIB.


  Indexed: An 8-bit index into a colormap that is shared between all
     layers. The colormap maps each index to an RGB triple which is
     interpreted as in the RGB model.


All layers in an image must use the same color model. Exception: if
the "floating selection" belongs to a channel or layer mask, it will
be represented as grayscale pixels independently of the image's
overall color model.

例外)channelやlayer maskに含まれる「フローティング選択」だけは、他のレイヤーのカラーモデルと関係なく、グレースケールを使用することができます。

Each pixel of a layer also has an alpha component which specifies the
opacity of the pixel on a linear scale from 0 (denoting an alpha of
0.0, or completely transparent) to 255 (denoting an alpha of 1.0, or
completely opaque). The color values do not use "premultiplied alpha"
storage. The color information for pixels with alpha 0 _may_ be
meaningful; GIMP preserves it when parts of a layer are erased and
provides (obscure) ways of recovering it in its user interface.

また、それぞれのピクセルはアルファ値を持っています。 これは、透過度を示すもので、最小値は0(不透明度=0.0:完全に透明)、最大値は255(不透明度=1.0:完全に不透過) この値は、"premultiplied alpha"[?]を使いません。 alpha値0はひょっとしたら意味があるかも知れません。 GIMPはレイヤーの一部が消された時や

The bottommost layer _only_ in an image may not contain alpha
information; in this case all pixels in the layer have an alpha value
of 255. (Even if the bottommost layer does not cover the entire
canvas, it is the only layer that can be without an explicit alpha


In images that use the indexed color model, GIMP does not support
partial transparency and interprets alpha values from 0 to 127 as
fully transparent and values from 128 to 255 as fully opaque. This
behavior _may_ change in future versions of GIMP.


Layers have certain other properties such as a visibility flag, a
global opacity (which is multiplied with individual pixel alphas) and
various editing state flags.



A channel is a named object that contains a single byte of information
for each pixel in the canvas area. Channels have a variety of use as
intermediate objects during editing; they are not meant to be rendered
directly when the final image is displayed or exported to layer-less

channelは、canvas上にある、ピクセルごとに1バイトの情報を保持している名前の付いたオブジェクトです。 channelは、画像編集中の媒介形式(中間形式)として、様々な使い方があます。、 このことは、channelは、最終的な表示やレイヤー構造を持たない画像形式への変換の際に描画されないことを意味しています。

A channel can be edited as if it was a grayscale layer with the same
dimensions as the canvas. When it is shown in the GIMP editor UI
together with other layers, it is used as if it was the _inverse_
alpha channel of a layer with the same color information in all
pixels; this color can be stored in the XCF file as a property of the
channel. This "mask" representation is generally thought of as an UI
feature rather than an intrinsic semantics of a channel.


The current _selection_ in the editor is stored as a channel in the
XCF file if it is nonempty. Pixels with a value of 255 belong to the
selection; pixels with a value of 0 don't, an pixels with intermediate
values are partially selected. A major use of channels is as a store
for saved selections.

現在の「選択範囲」はchannelとしてXCFに保存されます。(空領域でない場合) 選択範囲のピクセルには255段階の値が保存されます 値が0のピクセルはありませんが、中間値を保存することができます。 channelの主な目的として、選択領域の保存があります。

Though the channel data structure in the XCF file contains a height
and width field, these must always be the same as the canvas width and


Related to channels is the _layer mask_ that can be attached to a
layer. The layer mask is in fact represented as a channel structure in
the XCF file, but it is not listed in the master list of channels.
Its dimensions and placement coincide with those of its parent layer.
Unless disabled by the PROP_APPLY_MASK property, the layer mask
functions as an extra alpha channel for the layer, in that for each
pixel the layer's alpha byte and the layer mask byte are multiplied to
find the extent to which the layer obscures the background. Thus a
layer mask can make parts of the layer more transparent, but never
more opaque.

layerに追加できる「layer mask」も、channelと関連しています。layer maskは、XCFファイル内では、channel構造体として表現されています。が、channelのマスターリストには含まれていません。 layer maskの大きさと位置は、親となるレイヤーと同じです。 PROP_APPLY_MASKプロパティによって 無効にされない限り、layer maskはそのlayerの追加の透明度として機能します。そのlayerの各ピクセルのアルファ値と積算され、背景をどの程度透過するかを決定します。 したがって、layer maskは、透明度を高めるだけで、低くするということはありません。

0 件のコメント: