I need to extract the text from the layers in a photoshop PSD file on linux. Does anyone know how to do that? Gimp rasterizes the text and you can't copy and paste it. Also, note that I do not own the Photoshop program.
5 Answers
Have you tried using vim?
VIM comes with a flag that lets you edit a binary file.
I tried editing a PSD file with:
vim -b file.psd
This is an example of what I got when editing the file:
<dict> <key>com.apple.print.PageFormat.PMAdjustedPageRect</key> <array> <real>0.0</real> <real>0.0</real> <real>576</real> <real>734</real> </array> <key>com.apple.print.ticket.stateFlag</key> <integer>0</integer> </dict>

- 5,058
- 4
- 35
- 44
-
I get some text when doing that, but not all the text comes through that way – rado Jul 07 '09 at 19:16
-
1OK, now that I'm on my 10 PSD file, you have to regex two chars to make this work (at least with CS3 PSD format): "^0" to "" (empty) and ^M to "\r" makes it easier to see the text. – Screenack Jun 23 '11 at 22:23
-
I opened the psd file in Notepad++ and changed to a proper encoding and it worked. Thanks – inam101 Aug 16 '16 at 12:58
Just released this feature in the NPM package psd-cli
. Makes it simple to extract text content without the headache of manually running through the file...
One-line command install (needs NodeJS/NPM installed)
npm install -g psd-cli
You can then use it by typing in your terminal
psd myfile.psd -t
This will create myfile.txt
, containing all text extracted from each PSD layer with the layer structure attached.
Enjoy !

- 1,001
- 9
- 16
-
Sorry, this didn't work in my case, maybe the file was too large with long layer names (a mess). FYI I got this: `Processing myfile.psd ... [TypeError: Cannot read property 'replace' of null]` – aesede Jan 03 '17 at 00:47
-
I would be happy to debug this if you provide me an example file, and if possible send an issue on Github – kartsims Jan 03 '17 at 09:55
-
worked great for me, much better than `strings` that didn't work with any utf8 chars it seems – adipasquale Apr 18 '18 at 11:48
-
No need for the `-g` flag (install globally). Simply `npm install psd-cli`, then `./node_modules/.bin/psd myfile.psd -t`. Once you finished, you can delete the `node_modules` directory (and the `package-lock.json` file). No trace. – arcol Jan 28 '20 at 22:18
strings FILENAME > temp.txt
The file temp.txt
will contain all the plain text strings from the file, including some additional PSD settings. You'll have to manually search this file for the text you need.

- 3,891
- 2
- 30
- 33
-
1This tool is excellent. But I had to deal with a very large PSD, which resulted in a never-ending `cat temp.txt` so I used `-d` flag to narrow the amount of text read from the PSD, and `-e S` to tell `strings` tool that the text I wanted was UTF-8 (without this I got messed latin characters). The full command then would be: `strings -d -e S FILENAME > temp.txt` – aesede Jan 03 '17 at 00:45
You can use Photopea, it is not a desktop app, it runs in browser so you do not need to install anything, just open your psd file, and edit, or copy the text like in Photoshop:

- 1,295
- 1
- 10
- 22
Visit the internet site http://www.bram.us/2008/10/30/ps_bramustextconvert-psd2txt-and-txt2psd-for-the-masses/. There are two tools to export and import text from psd files. It goes very good!

- 31
- 1
-
-
1In case anyone stumbles onto this page, it is here: http://www.bram.us/2008/10/30/ps_bramustextconvert-psd2txt-and-txt2psd-for-the-masses/ – kikito Apr 16 '10 at 07:24
-
This site's scripts seem to require photoshop, which is ruled out by the user's question. – Tim Howland May 16 '11 at 02:17
-
Comparison of this option and the omgmog fork here: http://graphicdesign.stackexchange.com/questions/8411/is-there-a-simple-way-to-copy-all-text-in-psd-file/36090#36090 – ptim Jul 18 '14 at 15:53