GNOME Bugzilla – Bug 384472
"Open As Layers...", Layer Names...
Last modified: 2006-12-11 18:39:26 UTC
When using File > Open As Layers, or when dragging a file onto an image, the new layers are named Background Copy, Background Copy#1, etc... The more images that are added this way, the harder it is to keep track... I was wondering if the layer names could be changed to reflect the file and type it came from... Like: anImage.jpg, anotherOne.png, etc...
Yes, something like that could probably be done easily.
Actually, the code tries to preserve the layer names from the images you open. If you tell it to merge visible layers, it can't do that and will use the filename as you suggested. But in the case where you are adding the layers as is, the layer name isn't touched. The fact that you may end up with the layer names as you described is due to the fact that not all file formats have a concept of layer names. The file load plug-ins then use "Background" as a fallback layer name. I am afraid I don't see any reasoanble way to change this. The core simply doesn't know if the layer name is coming from the file or if it was just added by the file load plug-in.
what about: layer_name = g_strdup_printf ("%s-%s", filename, orig_layer_name);
That would work but could easily cause quite long and ugly layer names. But I can't think of anything better right now. Except that I would suggest to use "%s - %s" instead of "%s-%s".
Fixed in CVS: 2006-12-11 Michael Natterer <mitch@gimp.org> * app/file/file-open.c (file_open_layers): use the image file's basename as layer name if we import only one layer or if merge_visible was requested. Use "basename - layer name" otherwise. Fixes bug #384472.