GNOME Bugzilla – Bug 358082
"Open as layer" loads garbage when opening an animated gif
Last modified: 2007-09-25 14:18:17 UTC
Please describe the problem: Attempting to open an animated gif as layer loads a layer full of garbage data Steps to reproduce: 1. Open an image or create a new one 2. Select File -> Open as layer 3. Select an animated gif image to load Actual results: The animated gif opens as one layer, and it appears Gimp is expecting just one, thus it produces one layer of garbage data. Expected results: I would expect the complete animated gif to open as a pile of new layers. Does this happen every time? yep Other information:
Open as Layer merges all layers in the file that it opens. That is probably the garbage you are seeing. We might want to add a dialog that asks the user what to do. Or we might just want to change the default behaviour.
Ok, that explains it. I first thought a confirmation dialog would be needed to decide whether to load as flattened or layers, but the more I think about this, the more I seem to think it should just load the file as multiple layers - it is always possible to load one separately, flatten (or merge visible) and then add the resulting single layer to the image. Or is it possible to add a "[x] Preserve layers" in the "open-as-layer" -file dialog? I think that might solve it nicely, although the drag and drop -thing would then be different. Could the DND operation be somehow modifier-selectable whether it should preserve layers or not?
Let's change this in one way or another for 2.4.
Our internal function file_open_layer() returns a layer and this function is exported to the PDB. So it might become a little tricky to change this behaviour.
Coincidentially, i hacked this last night so file_open_layer() is now file_open_layers() and returns a GList. It works perfectly, I just have no idea yet how to present the new "gboolean merge_visible" parameter to the user interface or what to do with the PDB api. In my tree, all GUI use defaults to merge_visible = FALSE, and the PDB wrapper user merge_visible = TRUE and returns a single layer.
Do we need to expose this in the UI at all? We could simply default to TRUE and perhaps add a PDB wrapper called file-open-layers which defaults to TRUE and returns an array of layer IDs.
Fixed in CVS: 2006-11-03 Michael Natterer <mitch@gimp.org> * app/core/core-enums.[ch] (enum GimpUndoType): added value GIMP_UNDO_GROUP_LAYER_ADD. * app/file/file-open.[ch]: changed file_open_layer() to file_open_layers(), added parameter "gboolean merge_visible", return a GList of layers. * app/dialogs/file-open-dialog.c * app/display/gimpdisplayshell-dnd.c * app/widgets/gimplayertreeview.c: pass merge_visible = FALSE and add all returned layers to the image. Fixes bug #358082. (contains lots of duplicated code, will factor that out later). * tools/pdbgen/pdb/fileops.pdb (load_layer): pass merge_visible = TRUE (load_layers): new wrapper which returns all the image's layers. * app/pdb/fileops_cmds.c * app/pdb/internal_procs.c * libgimp/gimpfileops_pdb.[ch]: regenerated. * libgimp/gimp.def: changed accordingly.
*** Bug 480225 has been marked as a duplicate of this bug. ***