On Thu, 12 Jul 2007 23:29:01 +0200, [EMAIL PROTECTED] wrote:
> If there is an image specific value you do not need a default.  
> "overriding" a default with an image-specified value is a contradiction.

This reminds me about something that should be clarified...  For all
these parameters that affect how an image is saved, where do these
various values and defaults come from, and how to name them?

I propose the following terms (feel free to propose something else if
you have better ideas): "default", "original" and "current" values.
This is a slightly expanded version of the comment #14 that I added to
bug #63610 in 2003; in that comment I forgot the "original" setting.

1) The "default" setting is the one that is hardcoded or configurable
   in GIMP or in one of its plug-ins.  Sometimes the "default" value
   can be empty or not set.  Some examples: a default image comment
   can be configured in the Preferences, the JPEG plug-in uses a
   default quality setting of 85, GIF does not interlace the file by
   default, etc.  The "default" setting applies to all images.

2) The "original" setting is the one that is found (or not) when an
   image is loaded from disk.  For example, an image file may include
   a user comment and this comment will be preserved when the file is
   saved later.  The "original" setting only applies to that specific

3) The "current" setting is whatever is currently associated with one
   specific image.  Once it is set (coming from the "default" or
   "original" setting), it will always be used whenever this image is
   saved.  It can usually be changed by the user in the dialog window
   of the file plug-in.

In theory, these parameters should work like this: all new images or
images loaded from disk get the "default" setting except if some files
have an "original" setting, which is then used instead of the default
one.  This then becomes the "current" setting, which is associated with
that image every time it is saved.

In practice, there are several exceptions due to implementation
details or leftovers from the past.  For example, the "current" setting
may not actually exist until the file is saved (it only exists once
the save plug-in creates it).

But there is a bigger problem that I mentioned in bug #63610.  There
is a confusing historical feature that introduces another source of
settings for some parameters:

4) The "session" setting is a side-effect of the fact that file
   plug-ins currently behave like other plug-ins (filters).  This is a
   value that is set the first time you save a file in a specific
   format and that will affect all other images that you save during
   that session (until you quit GIMP).  This behavior is appropriate
   for filters but is confusing and dangerous for file plug-ins.

The problem with "session" settings is that something that is changed
when saving one image can trigger unexpected changes in all other
images.  For example, you use Save As to save an image using lower
quality settings for testing, but you do not see that from then on,
all other images that you save (normal Save) in the same format will
also use that lower quality instead of using the default value.

IMNSHO, the right way to fix bug #63610 is to provide an easy way for
all file plug-ins to save and reload one or more sets of "default"
values and then forbid all file plug-ins from using "session" settings
(save_args or save_vals or whatever the array of saved GimpParamDef is
called in each plug-in).  In fact, removing the usage of session
settings could already be done right now in all file plug-ins, even
before having a nice library for file plug-ins that would provide a
unified way to save and load default values.

This would solve one of the problems that has started this long thread
about the JPEG quality factor: saving one image in low quality will
not cause other unrelated images to be also saved in low quality.  The
other improvement that can be implemented without waiting is to read
or compute the "original" quality from JPEG files and to use it if and
only if it is better than the "default" quality.  I am working on a
simple extension of the nice patch that Tor provided a few days ago.

Gimp-developer mailing list

Reply via email to