Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.