[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gimp-developer
Subject:    Re: [gimp-devel] saving multiple layers or not?
From:       "Juergen A. Erhard" <jae () laden ! ilk ! de>
Date:       1998-05-22 12:15:28
[Download RAW message or body]

Send a reply... and then I noticed I didn't really `reply' in the
usual sense of the word... so here go my $0.02.

>>>>> "Raphael" == Raphael Quinet <Raphael.Quinet@eed.ericsson.se> writes:

    Raphael> Although I am an experienced GIMP user, I have been bitten more than
    Raphael> once by a famous "feature" of the GIMP: when you try to save a layered
    Raphael> image to a file that does not support layers, only the active layer is
    Raphael> saved.

What I propose in the other `reply' would cleanly do away with this.

    Raphael> I know that I should flatten the image first, or merge the visible
    Raphael> layers, but it is very irritating that the GIMP does not even warn me
    Raphael> about the fact that I am doing something stupid and I will loose most
    Raphael> of my work if I do not keep an XCF version of the file.  Fortunately,
    Raphael> I never lost anything important, but I introduced some colleagues to
    Raphael> the GIMP and one of them did loose at least one hour of work because
    Raphael> of this "feature".  Now he knows, but nobody should have to learn it
    Raphael> the hard way.

Right on (which is, admittedly, just a variation on `Me too'... ;-)

    Raphael> The best solution would be to have a dialog box asking you if you want
    Raphael> to flatten (a copy of) the image before saving it, or if you really
    Raphael> want to save a single layer.  Even if this nice auto-flatten feature
    Raphael> is not implemented, the GIMP must at least warn the user that some
    Raphael> information is going to be lost if the image is not flattened first.
    Raphael> This should be done before 1.0 bites lots of unsuspecting beginners...

Auto-Convert.  'nuff said (BTW, anyone (who happens to read this (who
*must* happen to be a very patient person)) know of any other source
for `'nuff said' than the one I know... Marvel Comics' Stan (The Man)
Lee?)

    Raphael> I have been thinking about it...  The problem is that the GIMP does
    Raphael> not know if a file saving plug-in is able to handle multiple layers or
    Raphael> not.  There are several ways to solve that:

Does the GIMP (the core) need to know?  Yeah, it does... (shit, this
makes the `reply' moot (or not so... the GIMP `just' needs to query
every file-save plug-in whether is can save the image in question
(okay, so this is sub-optimal performance-wise (so we need to improve
this whole mess, dummy!)))).

    Raphael> First solution: in gimp_install_procedure(), the list of supported
    Raphael> image types is given to the GIMP.  This string looks like: "RGB*,
    Raphael> GRAY*".  We could add a new "pseudo image type" that would tell the
    Raphael> GIMP that the plug-in supports layered images.  If this special type
    Raphael> is not given in the list, the GIMP would assume that the plug-in can
    Raphael> only work on the current drawable.  In order to announce that it
    Raphael> supports layered images, a plug-in would register itself with
    Raphael> something like this: "RGB*, GRAY*, LAYERS".  Any file saving plug-in
    Raphael> that is invoked on a layered image and does not support layers would
    Raphael> cause the GIMP (not the plug-in) to display a warning message.
    Raphael> Although this is a kludge, it would not require any changes in most
    Raphael> plug-ins.

Best solution IMHO... but we need to expand this, I think.  Come to
think of it, we don't.  My proposed scheme still works!!!!!!!
Yippieh!!!!!  Wow!!!!!  This is, like, totally rad!!!!

Okay, I caught myself... but we simply assume that EVERY PLUG-IN
HANDLES ANY IMAGE!  And the plug-in then offers to convert (see my
proposal).

Maybe... a plug-in can tell the GIMP (when registering) that it might
not handle all images.  Then, when a user tries to save an image in
this plug-in's format, the GIMP would explicitly ask the plug-in
whether it can handle this specific image (so maybe we just keep the
system as is... but make as many plug-ins handle as many formats as
they can (possibly all)).

    Raphael> Second solution: modify gimp_register_save_handler() and add an extra
    Raphael> parameter telling if the plug-in supports layers or not.  This would
    Raphael> require an update of all plug-ins that call this function (26 in the
    Raphael> stable distribution), but it should be rather easy to do.  On the
    Raphael> other hand, this is a bit dirty on the GIMP side, because
    Raphael> gimp_register_save_handler() is not supposed to know anything about
    Raphael> the supported image formats.

Huh?  I thought that RGBA/RGB/RGB* stuff is there for exactly this?
Or do you mean "`gimp_register_save_handler' is clueless, but the core
knows"?  I assume this to be the case...

    Raphael> A third solution is to define the new image formats RGBL, RGBLA,
    Raphael> GRAYL, GRAYLA, INDEXEDL and INDEXEDLA.  This is probably the cleanest
    Raphael> solution from a conceptual point of view and it would provide some
    Raphael> interesting information for all plug-ins (not only those that save
    Raphael> files).  But this would require some small changes in almost all
    Raphael> plug-ins, so I don't know if it is OK to do that.

Naw... it's not really clean.  When you go this route, you'll have
RGBLA_SOMETHINGOROTHER, CMYKLABGD and on and on...

    Raphael> If it was possible to know if a plug-in supports layers, it would be
    Raphael> possible to add a little visual clue in the Filters menu that would
    Raphael> tell the user if the plug-in is going to work on all layers or not.
    Raphael> The same could be done to the list of file formats in the load/save
    Raphael> dialog box.  Well, this addition to the menus would be for a future
    Raphael> version of the GIMP, but I think that the warning about loosing work
    Raphael> when saving an image should be part of 1.0.

As I propose, this lossage has to go... no *accidental* lossage!  Only
if the user says `Okay, trash my images'... then it's okay to do a
head-crash ;-)

    Raphael> I am willing to implement the third solution this week if most
    Raphael> developers think that it is the right thing to do.  Comments?

Think about my proposal...

Anyway,

Bye, J

--
Jürgen A. Erhard  eMail: jae@laden.ilk.de  phone: (GERMANY) 0721 27326
	My WebHome: http://members.tripod.com/~Juergen_Erhard
		 RedHat Linux (http://www.redhat.com)
	Win32 has many known work arounds. For example, Linux.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic