Skip to main content
Participant
Jun 14, 2016 1:34 PM UTC
Question

Import images to artboards?

Hello!

I'm trying to figure out a way to import images into their own artboards.

I know there's a script for importing into stacked layers but I don't really know Javascript enough to modify that to import into artboards instead.

Does anyone know of a script that does this? or of some scripts that do something similar that I could hack together to do what I want?

The second step would be to also name the artboards the same name as the image that got put into that artboard.

Thanks for any help/direction you can give me.

15 replies

GFE_MMXV
Participant
Nov 24, 2020 8:01 PM UTC

same. dont know how to do it 😞

Translate
Stephen Marsh
Community Expert
Community Expert
Jun 20, 2021 12:55 AM UTC

(1) Copy the code text to the clipboard

(2) Open a new blank file in a plain-text editor (not word processor)

(3) Paste the code in

(4) Save the text file as .txt

(5) Rename the text .txt to .jsx

(6) Install or browse to the .jsx file to run

(7) If these simple instructions are too abbreviated, you may need to read in more detail the full instructions:

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

Translate
Participant
Jun 20, 2016 12:59 PM UTC

Here's a screenshot example of what the end result should look like. (sans the logos)

I tried that script you found but it stops at line 43 for me. It prompts me saying the command select is not available. I click ok and gives me, Error user canceled the operation:

Line: 43

->    app.runMenuItem(sTID('selectAllLayers'));

I'll "play" with the code when I can to see if i can get it to work.

Translate
Ronald Anton
Participant
Jun 13, 2018 3:26 PM UTC

Here is the working script, simply removed the line 41.

// Version: 0.5.0

// Requirements: Adobe Photoshop CC 2015, or higher

// Author: Anton Lyubushkin (nvkz.nemo@gmail.com)

// Website: http://lyubushkin.pro/

// ============================================================================

// Installation:

// 1. Place script in:

// PC: C:\Program Files\Adobe\Adobe Photoshop CC#\Presets\Scripts\

// Mac: <hard drive>/Applications/Adobe Photoshop CC#/Presets/Scripts/

// 2. Restart Photoshop

// 3. Choose File > Scripts > filesToArtboards

// ============================================================================

#target photoshop

app.bringToFront();

function cTID(s) {return app.charIDToTypeID(s);}

function sTID(s) {return app.stringIDToTypeID(s);}

function newArtboard(_name, _w, _h) {

   var desc6 = new ActionDescriptor();

   var ref1 = new ActionReference();

  ref1.putClass(sTID('artboardSection'));

  desc6.putReference(cTID('null'), ref1);

   var desc7 = new ActionDescriptor();

  desc7.putString(cTID('Nm  '), _name);

  desc6.putObject(cTID('Usng'), sTID('artboardSection'), desc7);

   var desc8 = new ActionDescriptor();

  desc8.putDouble(cTID('Top '), 0);

  desc8.putDouble(cTID('Left'), 0);

  desc8.putDouble(cTID('Btom'), _h);

  desc8.putDouble(cTID('Rght'), _w);

  desc6.putObject(sTID('artboardRect'), sTID('classFloatRect'), desc8);

   executeAction(cTID('Mk  '), desc6, DialogModes.NO);

}

function main() {

   var fileList = app.openDialog("Select your files"),

   delta = 0,

   currentDocWidth = 0;

  if (fileList != null && fileList != "") {

   var doc = app.documents.add(400, 400, 72, "File1");

   for (var i = 0; i < fileList.length; i++) {

  app.open(fileList);

  currentDocWidth = app.activeDocument.width.value + 20;

   newArtboard(app.activeDocument.name, app.activeDocument.width.value, app.activeDocument.height.value);

  app.activeDocument.activeLayer.duplicate(doc, ElementPlacement.INSIDE);

  app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

  if (i > 0) {

  app.activeDocument.activeLayer.translate(delta, 0);

  }

  delta = delta + currentDocWidth;

  }

  doc.crop([0, 0, app.activeDocument.width + delta, app.activeDocument.height]);

  app.runMenuItem(charIDToTypeID("FtOn"));

   alert('Done!');

  }

}

main();

Translate
GFE_MMXV
Participant
Nov 24, 2020 7:20 PM UTC

hey! should i just copy and paste this? dont really know much about this.

Translate
Known Participant
Jun 18, 2016 5:43 PM UTC

I found this, but it seems to be broken..

LINK:

experimental-ps-scripts/filesToArtboards.jsx at master · nvkzNemo/experimental-ps-scripts · GitHub

// filesToArtboards.jsx - Adobe Photoshop Script
// Version: 0.5.0
// Requirements: Adobe Photoshop CC 2015, or higher
// Author: Anton Lyubushkin (nvkz.nemo@gmail.com)
// Website: http://lyubushkin.pro/
// ============================================================================
// Installation:
// 1. Place script in:
// PC: C:\Program Files\Adobe\Adobe Photoshop CC#\Presets\Scripts\
// Mac: <hard drive>/Applications/Adobe Photoshop CC#/Presets/Scripts/
// 2. Restart Photoshop
// 3. Choose File > Scripts > filesToArtboards
// ============================================================================
#target photoshop
app.bringToFront();
function cTID(s) {return app.charIDToTypeID(s);}
function sTID(s) {return app.stringIDToTypeID(s);}
function newArtboard(_name, _w, _h) {
   var desc6 = new ActionDescriptor();
   var ref1 = new ActionReference();
  ref1.putClass(sTID('artboardSection'));
  desc6.putReference(cTID('null'), ref1);
   var desc7 = new ActionDescriptor();
  desc7.putString(cTID('Nm  '), _name);
  desc6.putObject(cTID('Usng'), sTID('artboardSection'), desc7);
   var desc8 = new ActionDescriptor();
  desc8.putDouble(cTID('Top '), 0);
  desc8.putDouble(cTID('Left'), 0);
  desc8.putDouble(cTID('Btom'), _h);
  desc8.putDouble(cTID('Rght'), _w);
  desc6.putObject(sTID('artboardRect'), sTID('classFloatRect'), desc8);
   executeAction(cTID('Mk  '), desc6, DialogModes.NO);
}
function main() {
   var fileList = app.openDialog("Select your files"),
   delta = 0,
   currentDocWidth = 0;
  if (fileList != null && fileList != "") {
   var doc = app.documents.add(400, 400, 72, "File1");
   for (var i = 0; i < fileList.length; i++) {
  app.open(fileList[i]);
  currentDocWidth = app.activeDocument.width.value + 20;
  app.runMenuItem(sTID('selectAllLayers'));
   newArtboard(app.activeDocument.name, app.activeDocument.width.value, app.activeDocument.height.value);
  app.activeDocument.activeLayer.duplicate(doc, ElementPlacement.INSIDE);
  app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
  if (i > 0) {
  app.activeDocument.activeLayer.translate(delta, 0);
  }
  delta = delta + currentDocWidth;
  }
  doc.crop([0, 0, app.activeDocument.width + delta, app.activeDocument.height]);
  app.runMenuItem(charIDToTypeID("FtOn"));
   alert('Done!');
  }
}
main();
Translate
c.pfaffenbichler
Community Expert
Community Expert
Jun 19, 2016 12:34 PM UTC

The Script seems to work here, what is the problem on your set-up?

Translate
Known Participant
Jun 19, 2016 12:40 PM UTC

After I select the files to load, the script seems to get stuck at the line 40:

app.runMenuItem(sTID('selectAllLayers'));

I get a prommpt of the following contents:

The command "Select" is not currently available.

Translate
c.pfaffenbichler
Community Expert
Community Expert
Jun 17, 2016 3:13 PM UTC

Could you give screenshots of an example (including Layers Panel)?

Translate
Known Participant
Jun 18, 2016 6:16 PM UTC

This would be very desired feature for color grading between multiple images. Working with windows is cumbersome and distracting. The thick borders and shadows ruin how the photo is perceived on a print or in a layout where it is presented without any boarders against white background.

Artboards could serve as a "light table" where you could not only adjust colors in the context of other images, but also place them freely in a specific order for a story/editorial and see them as a whole.

I think this is much desired feature for photograpers and alikes.

Translate