Skip to content

firstplacelabs/py-psd-engineData

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

py-psd-engineData

Reads the text, font type, font size and color from a photoshop psd file

To first obtain the engineData you will need to install psd-tools, then you can parse the engineData with the following:

#HOW TO

from psd_tools import PSDImage
from engineData import getFontAndColorDict
#open the psd
fname = 'myPsdName.psd'
psd = PSDImage.load(fname)


for layer in reversed(psd.layers):
    #get the raw engine data
    rawData = layer._tagged_blocks['TySh'][-1][-1][-1][-1]
    rawDataValue = rawData.value
    
    propDict= {'FontSet':'','Text':'','FontSize':'','A':'','R':'','G':'','B':''}
    getFontAndColorDict(propDict,engineDataValue)
    #Then just index into the dictionary to get the values
    myText = propDict['Text']
    myFont = propDict['FontSet']

*note A R G B are percentages so to get the actual value multiply by 255

About

Reads the text, font type, font size and color from a photoshop psd file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages