如何从PSD文件中提取文本?

时间:2021-09-28 23:41:36

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.

我需要从linux上的photoshop PSD文件中的图层中提取文本。有谁知道这是怎么做到的吗? Gimp栅格化文本,您无法复制和粘贴它。另外,请注意我不拥有Photoshop程序。

4 个解决方案

#1


25  

Have you tried using vim?

你尝试过使用vim吗?

VIM comes with a flag that lets you edit a binary file.

VIM附带一个标志,可让您编辑二进制文件。

I tried editing a PSD file with:

我尝试用以下方法编辑PSD文件:

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>

#2


12  

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.

temp.txt文件将包含文件中的所有纯文本字符串,包括一些额外的PSD设置。您必须手动搜索此文件以查找所需的文本。

#3


11  

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...

刚刚在NPM包psd-cli中发布了这个功能。使提取文本内容变得简单,而不必担心手动运行文件...

One-line command install (needs NodeJS/NPM installed)

单行命令安装(需要安装NodeJS / NPM)

npm install -g psd-cli

npm install -g psd-cli

You can then use it by typing in your terminal

然后,您可以通过键入终端来使用它

psd myfile.psd -t

psd myfile.psd -t

This will create myfile.txt, containing all text extracted from each PSD layer with the layer structure attached.

这将创建myfile.txt,其中包含从每个PSD层提取的所有文本,并附加了图层结构。

Enjoy !

请享用 !

npmjs.org package description

npmjs.org包描述

#4


2  

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!

访问互联网站点http://www.bram.us/2008/10/30/ps_bramustextconvert-psd2txt-and-txt2psd-for-the-masses/。有两种工具可以从psd文件导出和导入文本。它非常好!

#1


25  

Have you tried using vim?

你尝试过使用vim吗?

VIM comes with a flag that lets you edit a binary file.

VIM附带一个标志,可让您编辑二进制文件。

I tried editing a PSD file with:

我尝试用以下方法编辑PSD文件:

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>

#2


12  

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.

temp.txt文件将包含文件中的所有纯文本字符串,包括一些额外的PSD设置。您必须手动搜索此文件以查找所需的文本。

#3


11  

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...

刚刚在NPM包psd-cli中发布了这个功能。使提取文本内容变得简单,而不必担心手动运行文件...

One-line command install (needs NodeJS/NPM installed)

单行命令安装(需要安装NodeJS / NPM)

npm install -g psd-cli

npm install -g psd-cli

You can then use it by typing in your terminal

然后,您可以通过键入终端来使用它

psd myfile.psd -t

psd myfile.psd -t

This will create myfile.txt, containing all text extracted from each PSD layer with the layer structure attached.

这将创建myfile.txt,其中包含从每个PSD层提取的所有文本,并附加了图层结构。

Enjoy !

请享用 !

npmjs.org package description

npmjs.org包描述

#4


2  

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!

访问互联网站点http://www.bram.us/2008/10/30/ps_bramustextconvert-psd2txt-and-txt2psd-for-the-masses/。有两种工具可以从psd文件导出和导入文本。它非常好!