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:
If the card from your designer is a Photoshop PSD file, you would use
card.psd[0]
in place ofcard.png
in the command above, since layer [0] of aPSD
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:then on Linux, you would do something like this
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.
Yes, it can be done. A sample is this video that does something similar: https://www.youtube.com/watch?v=4SJxl4vAbqI
you should be able to do it following this video. The Scripting is actually done in Excel taht accesses Photoshop via api call. Hit Alt+F11 on Excel to open up the programming interface.
I've had a bit of time to myself, so I've quickly written the basic structure of what you might need it loads in data from a (local) csv and turns it into text in photoshop. It's enough to get you started, even if it just one question.
CSV is as follows: 1 What's Gwen Stefani's real name? Bob Gwendoline Stefani Gwen Renée Stefani Gwen Stacey C
photoshop_script is as follows: