Re: Background color property for GIMP images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 26, 2009 at 8:01 AM, yahvuu <yahvuu@xxxxxxxxx> wrote:
> peter sikking schrieb:
>> I like the innovative nature of the idea.
> And i'm not aware of a raster file format which features that concept.

I just want to point out that PNG supports a background color (and the
GIMP plugin to save PNG offers an option to save the current brush
background color as the image background color), and being the only
format to do so we should probably consider its specified functions
and suggested behavior as potential starting points for GIMP's
handling of such.

4.2.4.1. bKGD Background color

The bKGD chunk specifies a default background color to present the
image against. Note that viewers are not bound to honor this chunk; a
viewer can choose to use a different background.

For color type 3 (indexed color), the bKGD chunk contains:

   Palette index:  1 byte

The value is the palette index of the color to be used as background.

For color types 0 and 4 (grayscale, with or without alpha), bKGD contains:

   Gray:  2 bytes, range 0 .. (2^bitdepth)-1

(If the image bit depth is less than 16, the least significant bits
are used and the others are 0.) The value is the gray level to be used
as background.

For color types 2 and 6 (truecolor, with or without alpha), bKGD contains:

   Red:   2 bytes, range 0 .. (2^bitdepth)-1
   Green: 2 bytes, range 0 .. (2^bitdepth)-1
   Blue:  2 bytes, range 0 .. (2^bitdepth)-1

(If the image bit depth is less than 16, the least significant bits
are used and the others are 0.) This is the RGB color to be used as
background.

When present, the bKGD chunk must precede the first IDAT chunk, and
must follow the PLTE chunk, if any.

See Recommendations for Decoders: Background color.

=========================================

10.7. Background color

The background color given by bKGD will typically be used to fill
unused screen space around the image, as well as any transparent
pixels within the image. (Thus, bKGD is valid and useful even when the
image does not use transparency.) If no bKGD chunk is present, the
viewer will need to make its own decision about a suitable background
color.

Viewers that have a specific background against which to present the
image (such as Web browsers) should ignore the bKGD chunk, in effect
overriding bKGD with their preferred background color or background
image.

The background color given by bKGD is not to be considered
transparent, even if it happens to match the color given by tRNS (or,
in the case of an indexed-color image, refers to a palette index that
is marked as transparent by tRNS). Otherwise one would have to imagine
something "behind the background" to composite against. The background
color is either used as background or ignored; it is not an
intermediate layer between the PNG image and some other background.

Indeed, it will be common that bKGD and tRNS specify the same color,
since then a decoder that does not implement transparency processing
will give the intended display, at least when no partially-transparent
pixels are present.
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux