Skip to content

Instantly share code, notes, and snippets.

@warp
Created August 6, 2011 07:14
Show Gist options
  • Save warp/1129122 to your computer and use it in GitHub Desktop.
Save warp/1129122 to your computer and use it in GitHub Desktop.
Dump text layers from photoshop psd files
#!/usr/bin/env ruby
content = File.open(ARGV[0], 'rb') {|io| io.read }
File.open(ARGV[0] + '.txt', 'w') do |file|
content.scan /Txt TEXT[\W]*([^\x0C]*)\x0C/ do |match|
s = $1.gsub(/\x00/, '').force_encoding('UTF-8')
file << s
puts s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment