Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 使用“创建多层psd文件”;“可编辑文本”;使用命令行_Linux_Image Processing_Imagemagick_Photoshop_Gimp - Fatal编程技术网

Linux 使用“创建多层psd文件”;“可编辑文本”;使用命令行

Linux 使用“创建多层psd文件”;“可编辑文本”;使用命令行,linux,image-processing,imagemagick,photoshop,gimp,Linux,Image Processing,Imagemagick,Photoshop,Gimp,我正在尝试使用命令行(linux/osx)创建PSD文件。 例子: 我有5个文本块 “你好” “这个” “是” “安” “示例” 我需要一种方法来采取这5块文字,并生成一个psd,将有5个不同的层为每个文本块,我需要他们是可编辑的psd后已生成并在photoshop中打开 你们熟悉能做到这一点的软件吗 我尝试了GIMP和ImageMagick,我能够生成一个包含5层文本块的psd,但不幸的是,ImageMagick似乎将文本转换为实际图像,因此一旦在photoshop中打开,文本就不可编辑。事实

我正在尝试使用命令行(linux/osx)创建PSD文件。 例子: 我有5个文本块

“你好” “这个” “是” “安” “示例”

我需要一种方法来采取这5块文字,并生成一个psd,将有5个不同的层为每个文本块,我需要他们是可编辑的psd后已生成并在photoshop中打开

你们熟悉能做到这一点的软件吗


我尝试了GIMP和ImageMagick,我能够生成一个包含5层文本块的psd,但不幸的是,ImageMagick似乎将文本转换为实际图像,因此一旦在photoshop中打开,文本就不可编辑。

事实上,大多数能够处理psd图像的软件只能处理其中的一个子集。GIMP本身只将文本PSD层作为像素打开

我对您的工作流程的提示是从photoshop内部编写脚本,然后创建另一种文件,带有文本标记,并在那里呈现。但是,通过命令行不可能做到这一点- (也许可以使用GUI自动化工具实现自动化)

啊-我突然想到了-也许你可以使用SVG文件格式,并在以后将其转换为PSD(虽然转换仍需要在Photoshop中手动交互-但可能SVG文件足够接近,你可以直接将其发送给最终用户,即PSD的替代品)

至于SVG方法:在Inskcape中创建一个新的模板文件,然后 你的5个文本块在你喜欢的地方。最终结果将包含XML块中的文本,如下所示:

<text
   xml:space="preserve"
   style="font-size:40px;...font-family:Sans"
   x="140"
   y="123.79075"
   id="text2999"
   sodipodi:linespacing="125%"><tspan
     sodipodi:role="line"
     id="tspan3001"
     x="140"
     y="123.79075">MyText here</tspan></text>

这种方法的优点是,您实际上可以以非常详细的方式设置模板的样式和格式。(嗯……浏览一下,photoshop似乎无法简单地打开SVG文件……不管怎样,这太糟糕了——也许你可以将所需的工作流程从中移开?

你可以使用Applescript或Extendscript为photoshop本身编写脚本——有一个可用的指南

您可以使用Applescript版本执行以下操作:

tell application "Finder" to set thePath to (home as string) & "TestText.tif"
set thePosix to quoted form of POSIX path of thePath
display dialog thePosix
do shell script "touch " & thePosix

tell application "Adobe Photoshop CC"
    activate
    make new document with properties {name:"Testtextlayers"}
    make new art layer at current document with properties {kind:text layer}
    make new art layer at current document with properties {kind:text layer}
    tell text object of art layer 1 of current document
        set {contents, size, stroke color} to {"Hello", 30.0, {class:RGB hex color, hex value:"913b8e"}}
    end tell
    tell text object of art layer 2 of current document
        set {contents, size, stroke color, position} to {"World", 48.0, {class:RGB hex color, hex value:"339966"}, {3, 4}}
    end tell
    set myOptions to {class:TIFF save options, image compression:none, byte order:Mac OS, save alpha channels:true, save spot colors:true, embed color profile:true}
    save current document in file thePath as TIFF with options myOptions appending no extension without copying

end tell

Extendscript版本在Linux和Windows之间可能更具可移植性。

太棒了,这真的很有帮助。谢谢你,马克!头脑清醒!谢谢你,杰斯布埃诺。我要试一试。
tell application "Finder" to set thePath to (home as string) & "TestText.tif"
set thePosix to quoted form of POSIX path of thePath
display dialog thePosix
do shell script "touch " & thePosix

tell application "Adobe Photoshop CC"
    activate
    make new document with properties {name:"Testtextlayers"}
    make new art layer at current document with properties {kind:text layer}
    make new art layer at current document with properties {kind:text layer}
    tell text object of art layer 1 of current document
        set {contents, size, stroke color} to {"Hello", 30.0, {class:RGB hex color, hex value:"913b8e"}}
    end tell
    tell text object of art layer 2 of current document
        set {contents, size, stroke color, position} to {"World", 48.0, {class:RGB hex color, hex value:"339966"}, {3, 4}}
    end tell
    set myOptions to {class:TIFF save options, image compression:none, byte order:Mac OS, save alpha channels:true, save spot colors:true, embed color profile:true}
    save current document in file thePath as TIFF with options myOptions appending no extension without copying

end tell