> 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.
thank you, that's interesting to learn. However, when examining the
consequences for the PNG plugin, the PNG behaviour turns out to be
completely different to the proposed XCF bg color.
This background color thingy touches on so many topics, that i'd like
to prepend that it's intended purpose is to avoid special-casing for a
unified image model which equips all layers with alpha channels.
The GIMP background color acts much like a semi-layer at the bottom of
the image which is always filled with a fixed color. You can't paint
on it, only change that color.
(In a way, the one desired anomaly - the eraser should not punch holes
into the default document - just gets shifted from the background layer
to the image bottom and is thereby made explicit.)
In effect, the user is provided a prominent place to state that she wants to
fill any transparency in the image projection with a fixed color.
This explicit information in turn simplifies the export process a bit.
The PNG format's background color behaviour is very different from that concept:
> 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.
which means that the PNG format makes a non-binding suggestion for the
image's environment. The proposed XCF bg color, in contrast, aims to define
the image pixels. And it is compulsory to evaluate the bg color when
such an XCF file gets rendered.
So introducing a bg color for GIMP images doesn't neccessarily imply any changes
for the PNG plugin:
- if the XCF bg color is opaque, the resulting PNG must be opaque, too.
The PNG bg color doesn't help with this, the user however is free to attach
- if the XCF bg color is transparent, the projection may contain
transparent pixels, which in turn are converted to transparent PNG pixels.
Here too, the PNG bg color is independent from the action.
GIMP's equivalent for the PNG bg color is Preferences->Display->Transparency.
I think it's best to provide a color chooser inside the PNG plugin and
possibly initialize that from the display preferences.
Gimp-developer mailing list