Reading Group Layers in PSD files
Posted: 2009-07-01T08:11:00-07:00
I was wondering if there is currently any work being done to support groups in PSD files?
Something that would be of immense value to me would be to be able to use "convert" from the command line and, instead of getting all the layers as separate PNG files, I would like to be able to get all the Layer Groups from the PSD file rendered into separate files.
It is my understanding that there is no such support at the moment. I am willing to spend some time developing the necessary code, if the community knows more about the PSD file format than I do.
I've compiled the ImageMagick code base and I'm stepping through the psd.c file while loading a large PSD file with many groups, each containing a variable number of layers. It seems to me that layer_info entries with a page width or a page height of 0 is removed as the current implementation ignores them. (Added by "palf" )
This could instead be used as "marker points" for an algorithm that splits up the layer_info into layer_group_info superstructures.
This type of segmentation could allow the extension of the "convert" command line command with another set of brackets.
Basically, it would be real nice to be able to write:
convert foo.psd[1-4][1-10] bar.png
which should be read as "for the first 4 groups in foo.psd, extract layers 1-10, and composite the ten layers into bar-group-1.png, bar-group-2.png, bar-group-3.png and bar-group-4.png" , or similar.
The syntax might be totally foolish, but I hope I'm being clear of what I want to get done.
Anyway, if anyone thinks this is worth the time, let me know. Also, tell me if this is a fool's errand. From what I've gathered, the PSD file format is one hairy beast, and not very programmer friendly. So, all comments on this is very appreciated.
Something that would be of immense value to me would be to be able to use "convert" from the command line and, instead of getting all the layers as separate PNG files, I would like to be able to get all the Layer Groups from the PSD file rendered into separate files.
It is my understanding that there is no such support at the moment. I am willing to spend some time developing the necessary code, if the community knows more about the PSD file format than I do.
I've compiled the ImageMagick code base and I'm stepping through the psd.c file while loading a large PSD file with many groups, each containing a variable number of layers. It seems to me that layer_info entries with a page width or a page height of 0 is removed as the current implementation ignores them. (Added by "palf" )
This could instead be used as "marker points" for an algorithm that splits up the layer_info into layer_group_info superstructures.
This type of segmentation could allow the extension of the "convert" command line command with another set of brackets.
Basically, it would be real nice to be able to write:
convert foo.psd[1-4][1-10] bar.png
which should be read as "for the first 4 groups in foo.psd, extract layers 1-10, and composite the ten layers into bar-group-1.png, bar-group-2.png, bar-group-3.png and bar-group-4.png" , or similar.
The syntax might be totally foolish, but I hope I'm being clear of what I want to get done.
Anyway, if anyone thinks this is worth the time, let me know. Also, tell me if this is a fool's errand. From what I've gathered, the PSD file format is one hairy beast, and not very programmer friendly. So, all comments on this is very appreciated.