casco antiguo quiero conocer gente láchar web de citas valdetorres aplicaciones para conocer gente solteros catolicos zahinos priego dating app

Photoshop scripts

P

First blog post, yay!

I have been running a global pole dancing community Poleranking since 2010 (more about this later). We have been travelling around the world to film pole dance competitions. From each event we film every performance and upload those to YouTube and the last years we have also provided a livestream so all the pole dance fans around the globe could have been able to watch their friends performing.

Anyway, there is “name bar” for each competitor and for years I have been creating these one by one (change the firstname, change the lastname, save file as and so on). Some competitions have 200+ contestants so creating these takes time and nerves.

Natalia Tatarintseva name bar
Name bar displayed in the beginning of each performance

Before every competition I have been thinking that after this competition I will write a PHP script (yes, I’m a code wizard) that reads .csv file and generates all those images automatically for me. After browsing different php libraries I find out that it seems to be too difficult to have exactly same graphics (font settings, gradient overlay, text kerning, drop shadow) as on Adobe Fireworks / Photoshop. So I decided to search html5 frontend solutions for this. I think with html5 canvas you could have exactly the same look and feel as I wanted, but the problem was saving the images. Saving each Image one by one, would have been a better and faster solution than creating everything manually, but I wasn’t happy for that (as I am super lazy).

Photoshop Variables!

I started to think if it is hard to get the same graphics as in Photoshop, could it be possible automate things inside the Photoshop? I knew there are Photoshop actions, but those doesn’t help as the content should be read dynamically outside of the Photoshop.

What about variables and datasets in Photoshop? I defined the name bar -layer as variable and loaded a dataset and i couldn’t believe it worked on the first try and this was super easy to setup. Ok, but now we got another problem. As you see the image above the name -layer has firstname and lastname, both with different color. Hmmm… with the Photoshop variables you can define text-layer variable to show content of one column of csv-file (excel file). So the solution was the split the name -layer to firstname and lastname layers, both with the correct color, split the csv file to firstname and lastname columns, define variables and load the dataset. And yes, we got the firstname and lastname show on the image.

New problem, the empty space between the firstname and lastname

New problem. As we now have the firstname and lastname on their own layers. The position of the lastname is wrong as it doesn’t start right after the firstname. The solution for this would be to force the event organisers to allow only those competitors perform whose firstname is 9 characters long.

Photoshop scripts!

Turns out that playing with variables and datasets is no go, what other options do we have? Google tells me something about scripting, sounds good! I’m reading more about Photoshop scripts. Wow, this is amazing. You can basically do everything with scripts as you would be using your mouse and keyboard.

What do we need?
– Photoshop template file which has all graphics in place (photo below)
– csv file which contants all data we want to place inside the photoshop
– script file where all the magic happens

Photoshop template which includes names for two people, country and name of category

What do we want?
I have always wanted to display more information than just the name of the performer. So we could easily add the nationality (country name) and the name of category he/she is competing in.
Also there is often “doubles” category in pole dance competitions and creating manually those name bars has always been “double work” to include names of two persons. So let’s add support for two different names. Also for national competitions it doesn’t make sense to display the country as everyone are from the same country.

Lets create .csv file: 
firstname,lastname,firstname2,lastname2,country,category
heikki,lampinen,,,finland,elite
heikki,lampinen,lola,bunny,,doubles

The csv file has “columns” for firstname, lastname, firstname2, lastname2, country, category.
The first row is for me, from finland and elite category.
2nd row is for me and the one and only lola bunny, no country, doubles category.

Now we only need the script file, are you ready?
The idea of the script is:

  • open .csv file
  • read the names from the file
  • generate a new image for each person
    • add firstname
    • add lastname and move it to next to firstname
    • if there is another person then add “&” sign, firstname2 and lastname2 and move next to first person lastname
    • if there is country field then add country and “-” sign
    • add category and move to correct position
  • save image as .png file

The whole script is about 130 lines. Save it as .jsx. Open your template file in Photoshop. Select File -> Scripts -> Browse. Select your .jsx file (I have the template file, csv file and script file in the same directory). And you are done! 2 new images 1920×1080 resolution and the left bottom corner looks like these:

Generated image from the csv data
Generated image for doubles without a country

In the future I’m going to send an excel file for the event organisers and they can fill it with competitors data. Then I save it as .csv, run the script in Photoshop and I have 100+ images ready to use for videos and livestream.

About the author

hesesses

Add Comment

By hesesses

hesesses

Get in touch

The best way to contact me is to spam hese@hese.io.

If you feel more like being a stalker, you can follow my glorious life at Instagram @heikkilampinen