有没有可以将文本从excel文件传输到Adobe设计程序的脚本? [英] Is there a script that can transfer text from an excel file into an Adobe design program?

查看:99
本文介绍了有没有可以将文本从excel文件传输到Adobe设计程序的脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在做一个问答游戏.我们在Google云端硬盘电子表格上有一个问题库.我们有一个在Photoshop中为问题卡进行通用设计的设计师.

现在,我们可以通过一些脚本,代码或任何其他自动化过程以某种方式将带有相应答案的问题转移到该设计中吗?

我知道有一个叫做PhotoshopScript的东西,值得仔细看看吗?

解决方案

我相当确定我不会在Photoshop脚本中尝试此操作,但是会选择ImageMagick,它已安装在大多数Linux发行版中,并且可用于Apple OS X和所有好的操作系统(和Windows)可从此处免费获得.

假设您在名为card.png

的文件中具有这样的PNG,JPEG或PSD版本的卡

然后,您可以在桌面上向其中添加文本,或者如果测验是在线的并且要动态生成问题卡,则可以以PHP脚本的形式添加文本:

convert card.png                   \
  -gravity center                  \
  -fill fuchsia                    \
  -font BradleyHandB               \
  -pointsize 48                    \
  -background none                 \
  label:'Q: Is this a question?\nA: If this is an answer.' \
 -compose srcover -composite out.jpg

如果设计者提供的卡是Photoshop PSD文件,则由于上面PSD文件的层[0]是整个扁平化的图像,因此您可以在上面的命令中使用card.psd[0]代替card.png. /p>

我建议您将问题从Excel 导出CSV(逗号分隔值)文件中,然后以小循环读取问题和答案以制作卡片非常简单

因此,假设您从Excel导出了一个名为quiz.cv的文件,如下所示:

Is this a question? If this is an answer.
What was Walt Disney's first name? Walt.
In English, what do the initials of the car manufacturer BMW stand for? Bavarian Motor Works

然后在Linux上,您将执行以下操作

#!/bin/bash
i=0
while IFS=$'\n' read question; do
   convert card.png                \
  -gravity center                  \
  -fill fuchsia                    \
  -font BradleyHandB               \
  -pointsize 48                    \
  -background none                 \
  label:'$question' \
 -compose srcover -composite card${i}.jpg
 ((i++))
done < quiz.csv

这将为您提供card0.jpgcard1.jpgcard2.jpg等.

当然,其他颜色,字体,布局,大小以及Windows版本的脚本也是可以的.这只取决于您想要什么.

We're making a quiz game. We have a question bank on a Google Drive Spreadsheet. We have a designer who has made a generic design for the question cards, in Photoshop.

Now, can we somehow transfer the questions, with the corresponding answers, onto this design through some script, code, or any other automated process?

I know there's a thing called PhotoshopScript, could that be worth taking a closer look at?

解决方案

I am fairly certain I wouldn't try this with Photoshop scripting, but would go for ImageMagick which is installed on most Linux distros, and is available for Apple OS X and all good OSes (and Windows) for free from here.

Let's say you have a PNG, or JPEG or PSD, version of your card like this in a file called card.png

Then you can add text to it like this, either on your Desktop, or as a PHP script if your quiz is online and you want to generate the question cards dynamically:

convert card.png                   \
  -gravity center                  \
  -fill fuchsia                    \
  -font BradleyHandB               \
  -pointsize 48                    \
  -background none                 \
  label:'Q: Is this a question?\nA: If this is an answer.' \
 -compose srcover -composite out.jpg

If the card from your designer is a Photoshop PSD file, you would use card.psd[0] in place of card.png in the command above, since layer [0] of a PSD file is the entire flattened image.

I would suggest you export your questions from Excel into a CSV (Comma Separated Values) file and then it is pretty simple to read the questions and answers in a little loop to make the cards.

So, say you exported a file called quiz.cv from Excel that looked like this:

Is this a question? If this is an answer.
What was Walt Disney's first name? Walt.
In English, what do the initials of the car manufacturer BMW stand for? Bavarian Motor Works

then on Linux, you would do something like this

#!/bin/bash
i=0
while IFS=$'\n' read question; do
   convert card.png                \
  -gravity center                  \
  -fill fuchsia                    \
  -font BradleyHandB               \
  -pointsize 48                    \
  -background none                 \
  label:'$question' \
 -compose srcover -composite card${i}.jpg
 ((i++))
done < quiz.csv

which would give you card0.jpg, card1.jpg, card2.jpg etc.

Of course other colours, fonts, layouts, sizes are possible, as is a Windows version of the script. It just depends what you want.

这篇关于有没有可以将文本从excel文件传输到Adobe设计程序的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆