Comments (11)
There is now as of v0.4.0 :)
PSD.open('examples/images/example.psd') do
puts resources[:layer_comps].data
end
# Outputs
{:class=>{:name=>"", :id=>"CompList"},
"list"=>
[{:class=>{:name=>"", :id=>"Comp"},
"Nm "=>"Version A",
"compID"=>692243163,
"capturedInfo"=>1},
{:class=>{:name=>"", :id=>"Comp"},
"Nm "=>"Version B",
"compID"=>725235304,
"capturedInfo"=>1},
{:class=>{:name=>"", :id=>"Comp"},
"Nm "=>"Version C",
"compID"=>730932877,
"capturedInfo"=>1}]}
from psd.rb.
I should add that, while it's now possible to get the layer comp names, I haven't discovered how to get the layers associated with each comp yet. Hopefully soon.
from psd.rb.
Thanks meltingice! I'll keep an eye out for it.
from psd.rb.
Reopening this because I just discovered, with 98% certainty, where the layer comp data is. It's hidden within the shmd
layer info block. According to the spec, there is a variable amount of "undocumented data" at the end of the shmd
block. Inspecting this data reveals a Descriptor that contains a list named compList
. This compList holds the IDs of the layer comps to which the layer belongs.
Working on it now.
from psd.rb.
{:class=>{:name=>"", :id=>"null"},
"origFXRefPoint"=>
{:class=>{:name=>"", :id=>"null"}, "Hrzn"=>0.0, "Vrtc"=>0.0},
"LyrI"=>22,
"layerSettings"=>
[{:class=>{:name=>"", :id=>"null"},
"enab"=>true,
"blendOptions"=>{:class=>{:name=>"", :id=>"null"}, "Md "=>"passThrough"},
"compList"=>[692243163]},
{:class=>{:name=>"", :id=>"null"}, "compList"=>[725235304]},
{:class=>{:name=>"", :id=>"null"}, "enab"=>true, "compList"=>[730932877]},
{:class=>{:name=>"", :id=>"null"}, "enab"=>true, "compList"=>[0]}]}
Was able to get the data parsed. Just need to organize it in a useful and easy to get fashion.
from psd.rb.
Fantastic! I think I can finally port some slow Photoshop plugin code. 👍
from psd.rb.
Any chance you could divulge some information about your use case? Trying to figure out the best way to represent this data.
from psd.rb.
Sure. I currently generate redlines for our comps using a Photoshop script. It iterates over layer comps and creates a meta-data layer overlaying type and size information for various layers. Both a non-annotated and annotated PNG is then exported.
from psd.rb.
Oh!, Great!
I also have some slow scripts that use layer comps
👍
from psd.rb.
So I've implemented a method for filtering based on layer comps:
tree = psd.tree.filter_by_comp('Version A')
tree.to_hash
The filter_by_comp
method takes a comp ID, a comp name, or :last for the last document state. It returns a new tree that only contains the layers/groups that are included in the comp, so you can traverse it as needed.
Still need to write tests before I merge it into master.
from psd.rb.
Going to close this since layer comp information is now available. To access, use psd.layer_comps
to get a hash of comps. You can also use the method from the previous post to generate a new tree based on a comp. Generating previews based on layer comps is hopefully coming soon.
from psd.rb.
Related Issues (20)
- Font sizes of a Usertext layer not getting matched after parsing the PSD file
- [Question] Exported Structure to PSD HOT 1
- Wrong bounds for `Shape` layer HOT 1
- ERROR: Error installing psd: ERROR: Failed to build gem native extension. HOT 4
- Way to correlate layer with scene number in imagemagick.
- Blending ranges
- Exported layer comp does not include clipping mask and adjustment layers
- How can I get the rotate angel in the psd
- undefined method `outset' for #<PSD::Slice> HOT 2
- Don't work with psd-enginedata v 1.1.1
- Saving as psd HOT 5
- 'Layr', 'Lr16' and 'Lr32' start at See Layer info.
- Error saving Layer Comp as png
- layer.type.styles doesn't work HOT 2
- How to distinguish Groups from Artboards
- nokogiri newer version not supported HOT 1
- Is it possible for us to replace the text layer and export it ? HOT 1
- Is that gem used anymore? I see last commit is from past 2 years?
- Potential problem with rle encoding?
- Get boundary of each style applied to text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from psd.rb.