我有一个多语言网站,需要自动从csv源更新在PSD-文件textlayers的过程。

我知道,有可能是因为改变宽度的PSP毛刺,但无论如何,它会帮助很多有文档中的文本。

我有哪些选择?

编辑:

Murmelschlurmel具有工作溶液。这里是链接到Adobe文档。

HTTP://livedocs.adobe。 COM / EN_US /软件/ 10.0 / help.html?含量= WSfd1234e1c4b69f30ea53e41001031ab64-740d.html

的CSV文件的格式是不是很好:你需要一个柱为每个变量。我希望每个变量一行。

它与元音变音(ä,ö等)

EDIT 1:

另一种解决方案是使用COM自动化的Photoshop。如果你有一对夫妇的需要更改的文本模板(按钮)那是很好的。这里是我的Python脚本,可能让你startet。

您需要与列的Excel文件: TemplateFileName,TargetFileName,TargetFormat,文本 (即template.psd,按钮1,GIF,NiceButton)。 未使用的片材的第一行。 在PSP模板应该只有1个textlayer和不能有layergroups。

import win32com.client
import xlrd 
spreadsheet = xlrd.open_workbook("text_buttons.xls")
sheet = spreadsheet.sheet_by_index(0)

psApp = win32com.client.Dispatch("Photoshop.Application")  
jpgSaveOptions = win32com.client.Dispatch("Photoshop.JPEGSaveOptions")  
jpgSaveOptions.EmbedColorProfile = True
jpgSaveOptions.FormatOptions = 1
jpgSaveOptions.Matte = 1
jpgSaveOptions.Quality = 1

gifSaveOptions = win32com.client.Dispatch("Photoshop.GIFSaveOptions")



for rowIndex in range(sheet.nrows):
    if(rowIndex > 0):
        template =  sheet.row(rowIndex)[0].value
        targetFile = sheet.row(rowIndex)[1].value
        targetFileFormat = sheet.row(rowIndex)[2].value
        textTranslated = sheet.row(rowIndex)[3].value
        psApp.Open(r"D:\Design\Produktion\%s" % template ) 
        doc = psApp.Application.ActiveDocument

        for layer in doc.Layers:  
            if (layer.Kind == 2):
                layer.TextItem.Contents = textTranslated
                if(targetFileFormat == "gif"):
                    doc.SaveAs(r"D:\Design\Produktion\de\%s" % targetFile, gifSaveOptions,  True, 2)
                if(targetFileFormat == "jpg"):
                    doc.SaveAs(r"D:\Design\Produktion\de\%s" % targetFile, jpgSaveOptions,  True, 2)

其他提示

这可能是有点过太多了,但我已经使用的Adobe AlterCast / Grphics服务器来处理完全相同的问题。

此外,如果它只是文字GIF / JPG图像,您可以使用Python + PIL(Python图像库)。 下面是一个示例代码(适用于Windows OS安装Arial和大阪的字体。)

#!/usr/bin/python
# -*- coding: utf-8 -*-
import ImageFont, ImageDraw, Image
#font = ImageFont.truetype("/usr/share/fonts/bitstream-vera/Vera.ttf", 24)
#font = ImageFont.truetype("futuratm.ttf", 18)
font = ImageFont.truetype("arial.ttf", 18)
im = Image.new("RGB", (365,20), "#fff")
draw = ImageDraw.Draw(im)
draw.text((0, 0), "Test Images", font=font, fill="#000")
im.save("TestImg_EN.gif", "GIF")


font = ImageFont.truetype("osaka.ttf", 18)
im = Image.new("RGB", (365,20), "#fff")
draw = ImageDraw.Draw(im)
draw.text((0, 0), u"テストイメージ", font=font, fill="#000")
im.save("TestImg_JP.gif", "GIF")
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top