Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List layers without loading image?
#4
(02-06-2021, 03:48 PM)ChameleonScales Wrote: Using python-fu, is there a way to list the layer names of an xcf file without loading the whole file?

Right now I list them like this:

Code:
image = pdb.gimp_file_load(some_filepath,same_filepath)
for l in image.layers :
    print(l.name)
gimp.delete(image)

The problem is that I use it on many very heavy xcfs and the listing can take a few minutes, which I feel could be improved.

I can find the layer names in the gibberish of the xcf when I open it with a text editor (Atom) but don't see a recurring pattern around so not sure this can be exploited by a direct text search in the file.

Any chance of there being an efficient solution?

None I know of.   And your code doesn't handle layer groups Smile. Do you start a Gimp instance for each image or is it the same Gimp instance that processes them all?
Reply


Messages In This Thread
RE: List layers without loading image? - by Ofnuts - 02-07-2021, 10:35 AM

Forum Jump: