2

I want inspect (and just that, without editing this layer) which font, size, color etc. were used in a given text layer in PSD file created with Photoshop. Is this doable without Photoshop.app? Pixelmator seems to be unable to accomplish that, same with Acorn. Anything else I could try?

1

For rather raw data, try saving this as, e.g. psdtext.py

#!/usr/bin/python

import sys, re

input = sys.argv[1]

# This write_title function is just for vanity and easier manual searching
def write_title(num):
  filler = 97
  if num < 10:
    filler2 = filler - 25
  elif num < 100:
    filler2 = filler - 26
  else:
    filler2 = filler - 27
  print("\n" * 2)
  print("#" * filler)
  print("#" * filler)
  print("#" * 11 + " Text layer " + str(num) + " " + "#" * filler2)
  print("#" * filler)
  print("#" * filler)
  print("\n" * 2)  

def psd_texts(input):
  t = x = 0
  for line in open(input, 'r'):
    if re.search("^\s+/Text\s+.*", line):
      x = 1
      t += 1
      write_title(t)
      print(line.rstrip('\n'))
    elif x == 1:
      if "warp" in line:
        x = 0
      elif ">>" not in line and "<<" not in line:
        print(line.rstrip('\n')) 

if __name__ == "__main__":
  psd_texts(input)

Then make it runnable: $ chmod a+x psdtext.py

Save the output as a file*: $ ./psdtext.py my_file_with_text_layers.psd > textinfo.txt

Open in an editor: $ open textinfo.txt

For example: you can search for /Text in your editor to loop through the text content of different layers, or search for /FontSet to loop through the fonts (the first font listed is the one the layer uses, others are fallbacks)

I know the output is ugly, but hey, it contains all the info.


*) I wouldn't do just $ ./psdtext.py file.psd as it visually messes up the Terminal — try e.g. $ ./psdtext.py file.psd | less instead.

1
  • Wow, thanks, maybe not the most convenient way, but with a little patience I should get all all the info I need ;)
    – piobyz
    Jul 6 '11 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .