Groups And Images From CSV

Script for Adobe Photoshop
Latest update 5/4/2024, version 1.1

The script reads a CSV spreadsheet of group and image names, creates the groups, and any groups within groups, and places imported images into specified groups.

  • Groups may be nested within others to any depth
  • The number of groups within groups may vary
  • Groups and images are named from CSV data
  • Scale images to fill, fit, or keep original size
Download
FREE 30 DAY TRIAL

Single-user perpetual license
Pay once, no subscription,
use forever

How-to Video

NOTE: after video production, features have been added in response to user feedback: Image placement options. See instructions below for details.

Before using the script

The script requires a spreadsheet of group and image names, saved as Comma Separated Values (CSV format) or tab-delimited text. The spreadsheet must have at least one column for a group or image name. More likely are a number of columns. To add a group, label the column head “group” and list the desired name of the group in the row below. Additional groups are nested inside the prior group (cell immediately to the left). To import an image, label the column head “image” and list the file name for the image in the row below. The image will be placed inside the group last created (or found if existing).

Groups And Images From CSV data example

In this example, columns with the head “group” are the names of groups to create. Any group name repeated does not make a new group, rather the existing group is used. Moving left to right across the spreadsheet, each column is another group that nests inside the last group. However, when the column head is “image”, instead of adding another group, the image is opened and placed inside the current group. When the last column of the row is complete, the next row starts at the top of the document and the process repeats. The result is shown in the image of the Photoshop Layers panel.

Groups And Images From CSV result

It is also possible to skip a group. Leave any cell under a group column empty and the group is ignored. The next column to the right nests inside the prior column that is not empty.

Groups And Images From CSV alternate data

You may also add another column for group after an image. This creates a group below the image, into which you may add another column for image and it goes into the last group created. These configurations are unlikely, but the script is designed to handle them.

How to use the script

The script works on the active document. You may begin with an existing document or create a new one the desired size and color space. Then run the script.

The interface has two sections: Data file and Images. Select the data file, the images folder, and image placement. Click the OK button to begin.

Section 1: Data file

CSV Delimiter — the character that separates columns of CSV data (does not apply to tab-delimited text). The default is comma, normal in the United States. Some European countries use semicolon rather than comma. Select the delimiter used in your region of the world.

File — select the data file, CSV or TXT.

Section 2: Images

Folder — select a folder to search for images. Any image listed in the data file found in this folder is imported into the Photoshop document. If an image is not found, the image is ignored and the user is notified when the script completes.

Image placement — determines how imported images are scaled and cropped.

Original — the image is placed at the original 100% size. Depending on differences in size and aspect ratio, the imported image may or may not reach the canvas edge and/or may or may not be cropped.

Fill — scales the image so its shortest dimension reaches the canvas edge while maintaining proportions. Any portion of the image that exceeds the canvas is cropped.

Fit — scales the image so its longest dimension reaches the canvas while maintaining proportions. None of the image is cropped. Any portions of the image that do not reach the canvas edge are filled with white.

Stretch — scales the image non-proportionally so that both dimensions reach the canvas edge.

After an image is scaled it is centered relative to the document. Note that steps the script performs are not possible with indexed color. Any images that are indexed color are converted to 8-bit sRGB.

Language

By default the script language is US English, which does not require further download or configuration. To have the script interface display other languages, choose from the available languages below. Download and copy the .i18n file to the script folder alongside the script. When launched, the script detects the language file and displays interface text in that language. If your language is not listed, download the English file and translate it. The file is plain text formatted as JSON, containing interface text in English, and a second value for its translation, which for the English file is the identical text. Copy the file and rename it to replace “en” with the relevant code for your language, then edit the file to change each line’s second value to the translation in your language. For more detailed instructions of how to edit and install i18n files, see How to Localize Scripts.

English: groups-and-images-from-csv-en-i18n.zip

Download
FREE 30 DAY TRIAL

Single-user perpetual license
Pay once, no subscription, use forever

Change log: groups-and-images-from-csv.txt

For help installing scripts, see How to Install and Use Scripts in Adobe Creative Cloud Applications.

IMPORTANT: scripts are developed for the latest Adobe Creative Cloud applications. Many scripts work in CC 2018 and later, even some as far back as CS6, but may not perform as expected, or run at all, when used in versions prior to 2018. Photoshop features Select Subject and Preserve Details 2.0 definitely fail prior to CC 2018 (version 19) as the features do not exist in earlier versions. For best results use the latest versions of Adobe Creative Cloud applications.

IMPORTANT: by downloading any of the scripts on this page you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.

IMPORTANT: fees paid for software products are the purchase of a non-exclusive license to use the software product and do not grant the purchaser any degree of ownership of the software code. Author of the intellectual property and copyright holder William Campbell retains 100% ownership of all code used in all software products regardless of the inspiration for the software product design or functionality.