08-18-2024, 04:51 PM
Using Photoshop to Automate:
- This guide is from our member Curswine, (Source) thx a lot!
So what I'm aiming to do is setup a .PSD file in Photoshop that will use a .CSV file to produce thumbnails of all fixtures in a league or cup competition.
What You'll Need:
Method:
Open Photoshop:
Google Sheets:
Back in Photoshop:
Saving in Photoshop:
Notes:
The official TheSportsDB shared repo: https://github.com/zag2me/TheSportsDB
To share any templates, files,.. use our download section.
Youtube Video about this: Auto-Create 100s of Custom Designs using "Variables" in Photoshop!
Place for more..
- This guide is from our member Curswine, (Source) thx a lot!
So what I'm aiming to do is setup a .PSD file in Photoshop that will use a .CSV file to produce thumbnails of all fixtures in a league or cup competition.
What You'll Need:
- Adobe Photoshop 7 or newer.
- Google Sheets (Although any spreadsheet software should work.)
- An advanced text editor (I use Notepad++ (Optional))
Method:
Open Photoshop:
- Start off by creating a new .PSD file in Photoshop and make it 1280x720.
- Design your fixture layout however you want to, mine looks like this to start off with. My base looked like this.
- Once you're happy with how it looks, click on the 'Rectangle tool' and drag out a shape where you wish your home team logo to be, also note that this will define how large your logo will appear on your finished design.
- Here I have chosen to make a 278x278 square and then duplicated it and put the second square where I want my away team logo to appear.
- Name these layers something obvious as if you don't things may get confusing later. I have named mine 'Home Team Logo' and 'Away Team Logo' respectively.
- Make a text layer named 'Filename', this doesn't have to show on the image, it can be a hidden layer.
- Save the .PSD in a folder with the logos that you're going to be using to display as fixtures.
Google Sheets:
- Open a new sheet and name it however you like.
- You're now going to have to create your fixtures, this could be done in a number of ways depending on your familiarity with spreadsheet software.
- My method here was to create two columns, the first one. which I named Home_Logo displayed 111111222222333333444444555555666666, and the second which I called Away_Logo showed 123456123456123456123456123456123456. I then deleted all the entries where the two values were the same since a team cannot play itself. I then sorted the first column so that there were no blank rows.
- Using Find and Replace (Ctrl+H) I then substituted the numbers for the logo filename; for example 1 as replaced with Banga.png, 2 with Kauno.png etc.
- I also made sure to add a column called 'Filename' which is what Photoshop will use to name files. I used the two team names separated by an underscore as my filenames: Banga_Kauno. Here's how mine looked.
- Now it's time to save your file as a .CSV, make sure to save it to the same folder as your .PSD where your logos are located. Your folder should look a bit like this.
Back in Photoshop:
- Now to link the ,CSV to the .PSD. With your file open navigate to 'Image > Variables > Define...'
- In the 'Layer' drop down box find your layer that you named 'Home Team Logo' earlier.
- Tick the 'Pixel Replacement' checkbox and in the 'Name' field type in 'Home_Logo' or whatever you named the column in your .CSV file.
- Now once that is done navigate again to the 'Layer' drop down box and find the layer named 'Away Team Logo'.
- Again tick the 'Pixel Replacement' checkbox and in the 'Name' field type 'Away_Logo'.
- Finally find your 'Filename' layer, click the 'Text Replacement' box, and type in 'Filename'.
- If you've done this correctly each layer should now have an asterisk (*) next to their name in the drop down box. It should look something like this.
- Next click on the drop drown box which says 'Define' and click on 'Data Sets'. Alternatively click on 'Prev' or 'Next', they all lead to the same place.
- In the 'Data Sets' screen click on the button which says 'Import...' and then navigate to where your .CSV file is saved. Also make sure the two check boxes in this window are ticked. Click 'OK'.
- If everything has gone to plan you should now be able to view all your fixtures with the logos instead of the squares, click through them all to make sure that they work, if not it is best to check that filenames are correct. You may also receive error messages at this stage.
Saving in Photoshop:
- Once you're happy with everything it's time for saving. Go to 'File > Export > Data Sets as Files...'.
- This will bring up a menu for you to select where you wish to save your files to and how you wish to name them, if you included a 'Filename' column they should automatically be named this. If not, play around with the options till you get a filename format you're comfortable with.
- Unfortunately there is no way to export the files directly as .JPG files, so they must first be saved as individual .PSD files , so it's best to make your original .PSD file as light as possible before exporting.
- Once you've picked a location for your files to be saved and clicked 'OK' to export your files, navigate to 'File > Scripts > Image Processor...'.
- In the first section of the 'Image Processor' window navigate to your folder full of newly created .PSD files.
- In the second section I choose 'Save in Same Location', Photoshop will automatically create a 'JPEG' folder.
- In the third section choose a file quality, 12 is best, here you can also resize the images if you so wish.
- Click 'Run' and Photoshop will begin to process all the images into .JPG files. The end result https://i.imgur.com/a6NQYMD.jpg
Notes:
- This is probably the simplest method there is, of course it can be made more complicated by whatever different design features you wish to include like team names, event times, round names, country flags etc. These would involve adding more columns into the .CSV file and pointing the .PSD to the right location for the information.
- If you're using diacritics in text ÁáÉéÍíÓóÚú etc. Make sure to open the CSV in the text editor first and convert it to ANSI coding, if you don't do this it is likely that the letters will not display correctly in Photoshop.
The official TheSportsDB shared repo: https://github.com/zag2me/TheSportsDB
To share any templates, files,.. use our download section.
Youtube Video about this: Auto-Create 100s of Custom Designs using "Variables" in Photoshop!
Place for more..