Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List layers without loading image?
#11
(02-10-2021, 02:13 AM)eepjr24 Wrote:
(02-08-2021, 03:24 AM)ChameleonScales Wrote: Sure, what my plug-in does is from a given root directory and with a given maximum search depth, it finds all the xcfs and lists them in a csv table where each row is an xcf and each column is one of its layers (except the first column which is the url of the xcf).
Additionally, each "layer cell" of the csv contains the visibility state of the layer (whether the eye is open or closed) by inserting an identifiable string at the start of the cell.

Right now it works by using the Gimp api and I've started making a GTK dialog to make your "super-fast" version work outside of Gimp with the same functionalities.

I actually forgot to mention that "visibility" part, sorry about that (*∩▂∩). So right now I'm missing that from your version.
If it even is possible, do you perhaps know how to do that? (º̩̩́⌣º̩̩̀ʃƪ)

Consider my answer just a pointer in the right direction until tmanni or someone else who knows the xcf format can chime in. I think what you are looking for is:

PROP_VISIBLE (essential)
 uint32  8   The type number for PROP_VISIBLE is 8
 uint32  4   Four bytes of payload
 uint32  b   1 if the layer/channel is visible; 0 if not


I pulled this from HERE, which is a partial XCF specification that will probably come in handy for the type of work you look to be doing. I only dabble in Python, so I'm not going to attempt to give a code example, but you are reading the layer name and the property list follows it immediately in the file:

 string  name   The name of the layer
 property-list  Layer properties (details below)

That means from the name you should be able to seek N bytes forward in the file (where N is the sum of the bytes of the properties until the PROP_VISIBLE flag) and read / convert it (I think bitstring would be okay for this). Again, this is just to help you along in the mean time, I am no expert.


- E 

Note tha there are currently two XCF formats, the up-to-2.8 one and the 2.10-onwards one, that supports (among other things) more channel blend modes and high-precision data. Not sure it matters here, but not sure it doesn't either...
Reply


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

Forum Jump: