Need script to batch import images into PSD layer

Hi,
I have a large group of identically sized Illustrator PDF images (I could convert these to jpeg and resize separately...). I need to import each of these into a specific part of another image, which will always be constant  The incoming image should be the back layer and the file should be saved as a jpeg, and named after the incoming image's file name. 
What's the best approach here?
Thanks, everybody. 

Hello.
I've tried to adapt this script I to  update a sprite sheet.
The sprite sheet contains 6 smart objects, which where created by importing PSD containing 1 transparent rasterized layer, converting to SmartObjects, then repositioning and scaling.
The script has two faults. Either it runs and replaces the images, but moves them about vertically.
Or it simply throws an "General Photoshop Error. This method may not be.. etc" error and highlights this line :
executeAction( idplacedLayerEditContents, desc2, DialogModes.NO );
I'm still getting to grips with the completely bonkers API, looking at what looks like assembly language bubbling up through the "baretail" application.
Any tips as to why it's erroring out or coming in in the wrong places vertically (looks OK horizontally) most appreciate.
It's the bizarre intermittent error that bugs me most, sometimes it runs and does it wrong, sometimes I just get a bing  noise.
Script is here :
http://www.charlescrammond.co.uk/downloads/ReplaceContentsOfSmartObjects.jsx
Sample PSDs I'm using are  here :
http://www.charlescrammond.co.uk/downloads/spritesheet.zip
any help much appreciated! meanwhile, I guess back to the UI and manually doing it
Charles
/// Script to automate replacing contents of smart layers with selected psds
/// Sometimes it just about works, and replaces the images fine but moves them down vertically.
/// Sometimes it throws an error at :
///  executeAction( idplacedLayerEditContents, desc2, DialogModes.NO );
#target photoshop
if (app.documents.length > 0)
   var myDocument = app.activeDocument;
   var thePath = myDocument.path;
   var pngopts = new PNGSaveOptions();
   pngopts.interlace = false;
function swapImages()
      // select files;
      if ($.os.search(/windows/i) != -1)
         var theFiles = File.openDialog ("please select files", "*.psd;*.psb", true)
      else
         var theFiles = File.openDialog ("please select files", getFiles, true);
      if (theFiles)
         // work through the array;
         for (var m = 0; m < theFiles.length; m++)
            // open smart object; in active document
            var getLayerToChange = app.activeDocument.artLayers[m];
            app.activeDocument.activeLayer = getLayerToChange;
            var smartObject = openSmartObject (getLayerToChange);
            // get a reference to the layer within
            var theLayer2 = smartObject.activeLayer;
            // replace smart object;
            if (theLayer2.kind == "LayerKind.SMARTOBJECT")
               replaceContents (theFiles[m]);
               // This closes the current image source file.
               smartObject.close(SaveOptions.SAVECHANGES);  
               // not  sure this is needed but what the hell
               delete smartObject;
         //save png;
         $.writeln("Saving a PNG");
         myDocument.saveAs((new File(thePath+"/"+"spritesheet.png")),pngopts,true);
////// get psds and psb  from files //////
function getFiles (theFile)
   if (theFile.name.match(/\.(psd|psb)$/i))
      return true
////// replace contents //////
function replaceContents (newFile)
   var idplacedLayerReplaceContents = stringIDToTypeID( "placedLayerReplaceContents" );
   var desc3 = new ActionDescriptor();
   var idnull = charIDToTypeID( "null" );
   desc3.putPath( idnull, new File( newFile ) );
   var idPgNm = charIDToTypeID( "PgNm" );
   desc3.putInteger( idPgNm, 1 );
   executeAction( idplacedLayerReplaceContents, desc3, DialogModes.NO );
   return app.activeDocument.activeLayer
////// open smart object //////
function openSmartObject (theLayer)
   if (theLayer.kind == "LayerKind.SMARTOBJECT")
      var idplacedLayerEditContents = stringIDToTypeID( "placedLayerEditContents" );
      var desc2 = new ActionDescriptor();
      // why does this line here throw errors sometimes, and sometimes not.
      executeAction( idplacedLayerEditContents, desc2, DialogModes.NO );
   return app.activeDocument
// Call main function
swapImages();

Similar Messages

  • How can I batch import images 1 per page?

    I need to import images into the same Fireworks file, 1 per page. I have about 60 to do, and I'm hoping there's a better way then just adding them one by one. How can I batch import so that a page is created for each image?

    You can use the Import Files into Pages command in this extension: http://johndunning.com/fireworks/about/PageCommands
    Just select all the files in the file selection dialog.  They'll be imported one to a page, sorted by their filename.

  • Auto import images into aperture...and continue importing...

    i know that there is a script to import images into aperture, but i need to use this with a tethered camera....so i use a canon app to shoot files to a folder and as the files come in, i need them to get imported as they keep coming in....i am only referencing them, so they are actually staying within the folder....i can import the files but i don't know how to/which command "keeps checking the folder for new files that came in" hope this makes sense....
    i know that there is a "hot folder" app available which seems to be a automator app, but it is superslow and only brings in every 4th or 5th image (and sometimes just brings everything to a halt...)

    i know that there is a script to import images into aperture, but i need to use this with a tethered camera....so i use a canon app to shoot files to a folder and as the files come in, i need them to get imported as they keep coming in....i am only referencing them, so they are actually staying within the folder....i can import the files but i don't know how to/which command "keeps checking the folder for new files that came in" hope this makes sense....
    i know that there is a "hot folder" app available which seems to be a automator app, but it is superslow and only brings in every 4th or 5th image (and sometimes just brings everything to a halt...)

  • Importing Images into IDVD for Slidshow

    I am at a loss as to what is the best image size, resolution size, etc. when it comes to importing images into IDVD. I usually size my prints
    4 x 6 @ 300 dpi.. This looks fine in the slideshow preview. After I burn the dvd and view it, the images lose quality, etc..
    Any help would be appreciated

    What you're creating in iPhoto is a movie file that will get cut off in iDVD because of the TV over scan issue. Only stills imported and assembled into a slideshow in iDVD can be scaled to avoid the over scan.
    So to get what you want you'll have to import the stills into iDVD from iPhoto and create the slideshow there.
    If you have Quicktime Pro you can mask the QT movie with a black mask and cause the iPhoto QT movie to be scaled to the TV safe area. The steps are below. You'll have to experiment with the final sizes to get it exact:
    Masking Movies to the TV Safe Area for iDVD
    The mask should be 640 x 480 pixels and the movie at approx. 580 x 386 (I arrived at this figure by making a snapshot of the TV save area of an iDVD project with Snapz). You can set this size after you’ve joined it with the mask movie with Quicktime Player Pro.
    Import the black mask jpg file into iMovie and and export it as a .mov file at the same length as your movie (there may be a way to not have to create a specific length mask for each movie but I haven't found it. If the times do not match the movie file will be synced to the length of the mask movie).
    Open the mask movie in QT Player Pro and then open your regular movie and make it the front window of the two. Now you'll need to run a QT Player AppleScript titled "Merge Movie 1 into Movie 2". You can get it from this Apple site: Quicktime Player Scripts.
    Then run the script. You can then run the merged movie to check it out. Your movie will be located in the upper lefthand corner of the window when played.
    When you open the Movie Properties window from the Window menu for the combined file you’ll see the following:
    Video Track 1: the black mask
    Video Track 2 : you movie file
    Tween track: Have no idea what this is.
    Sound track: self explanaotry
    Black mask.
    To set the size of your movie to the correct size select it in the Properties window and click on Visual Settings pane. Then enter 580 in the first field and hit enter. With the Preserve Aspect Ration box checked the other size will automatically be set.
    To center the video track in the center of the mask select the Video Track 2 item and plug in a offset of about: 70 & 45. You'll probably have to play with that to fine tune the centering. Doing the math and subtracting the movie dimensions from the mask dimensions and dividing by two just didn't get it perfectly centered bit with a little eyeballing and trial and error it got there.
    Now save as a new self contained movie after checking the High Quality box at the bottom right.
    You can now import it into iDVD for preview and burning. One drawback is that you can't invoke the TV save area for a movie in iDVD to check it out. But you can mark it on the monitor screen while viewing a menu or slideshow and then play the movie to see how close you came. I found that the size was still a little under the TV safe area when burned and played on my TV. It may be the difference in normal CRT screens and flat screens, etc.

  • Load/import images into layers to create animated gif in PE4

    I'm trying to make an animated gif using Photoshop Elements 4.0.
    I have numerous images (photos) that I need to insert into separate frames of one image.
    (photo1, photo2 ..... photo10 - all combined in layers to create the frames of the animated gif)
    I can open each photo separately, copy it, go the the animated gif image, create a new layer, and paste the image into the layer to create a frame in the animated gif.  This is very time consuming.
    Does Elements 4.0 allow for just opening/importing the separate images (photos) into the layers (frames) of the gif direclty?  I remember having software that came with Macromedia Dreamweaver 4.0 in 2000 that made this simple and straight forward.

    We are not the right people to ask.  The Touch forum (for tablet) is at
    Adobe Photoshop Touch for tablet
    There's a long list f video tutorials here, but I can't see anything about animation
    Learn Photoshop Touch | Adobe TV

  • When importing images into LR5 on my laptop, the photos all have a wide yellow streak through them. This only happens on the laptop; I can import the images onto my desktop LR and there isn't the streak of colour.   Can someone help?

    When importing images into LR5 on my laptop, the photos all have a wide yellow streak through them. This only happens on the laptop; I can import the images onto my desktop LR and there isn't the streak of colour.   Can someone help?
    This is happening even with photos that were taken on another camera, not just mine.  My daughter told me that the laptop recently fell.  The yellow streak is not anywhere else on the laptop, just on the photos in LR.

    I have had this problem on my desktop.  I have been attempting to reproduce it where it can be debugged. Here are some observations/facts in my environment--no conclusions:
    1. I do not import from camera or memory stick directly into LR.  I copy all images (using Explorer) from camera to two different locations (backup location first); and then my working area. In both cases, after files are copied I mark them Read-only.
    2. Poor observation, but in any event: the issue has only occurred when I do a large number of images. Its a poor observation as I have no exact number.  I suspect when I do less than 50 always works well every time.  However, I have also done some very large imports without issue.
    3. Error only occurs with my RAW images--for me that's NEF.  I have multiple cameras--those that only capture jpg images have never had an issue in LR.
    4. Even if the file is marked Read Only issues can still occur.  I then remove the image from the disk using LR -- and then manually (Explorer) copy in my backup image -- re import again and all is well.  I think one time I exited LR and replaced the bad file with a backup and restarted LR and all was well again.
    5. When it occurs I have performed a HASH value on the broken file and on the backed up file to determine if the file contents has changed--and each time the file contents has changed.
    6. I have had this occur immediately after import, but most often it occurs like this... import large number of images; Make changes in Development Module on random image, export jpg of changes--exit LR. Open up LR and file is corrupted.
    7. I have had this issue on multiple USB drives ( okay just 2 different drives have been tested ).
    What next--fire up Process Monitor and monitor the system (specifically LR) to see if it reports any file open for write access when this occurs.  So, far I have not had process monitor actually running when it occurs--one of these days.

  • Importing images into Flash

    I am importing images into Flash only to discover that the images (1280 x 720) are not centered on the stage.  Most of the time the images are off centre by a few pixel widths or in some cases by an inch or more.   I can't get them to centre unless I clear the stage and import a few times.
    Is there a way to import and have the images framed perfectly within the stage.
    I'm currently using Flash CS5.5
    Thank you.

    You can also click the two blue boxes icon under the Timeline and then drag select the whole timeline and that will let you select all your frames at once. then just position them all where you want them at the same time. I attached a screen cap of the area I'm talking about. It's right after the two white boxes.

  • What is the best format to import images into iBA? How should I compress my images before importing? What is the best file format? PNG? Jpeg?

    What is the best format to import images into iBA? How should I compress my images before importing? What is the best file format? PNG? Jpeg? I'm trying to figure out the best file format / compression for importing images into iBA. Also, does anyone know how iBA will compress the file? Are the assets attached (like a website) or flattened out? Does anyone know how iBA handles this? Many many thanks to anyone with insight into this.

    This question is largely answered by the following thread...
    https://discussions.apple.com/message/17805700#17805700

  • Problems with importing images into Lightroom cc

    Problems with importing images into Lightroom cc
    I have installed lightroom cc and having trouble imortera images from my Canon 1DX.
    Lightroom starting the capture, but then nothing happens more, if I turn off the camera, I get error message photo 100-200 could not be loaded.
    Now I have left lightroom 5 and where the input port works fine.
    What happened to the upgrade from Lightroom 5 to lightroom cc?
    The camera has the latest software.

    I've now tested in various ways.
    First, I have images on both memory cards in the camera.
    Test1) Selects Not all of the photos in the camera at the input port bearings, it seems to work fine.
    Test 2) selects all cards in the camera and then get the following, Lightroom starts inportera short but stops and nothing happens (Fig.1).
    I turn the camera off after a while and get the next meddelnade (picture 1)
    Which can be translated:
    "The following files were not imported because they could not read (351)
    Property 1-100
    etc. "
    Picture 1.
    Picture 2

  • How to import images into BLOB datatypes

    Dear All,
    I'm trying to import image into BLOB table type.I'm executing this SQL commands but found error.
    ORA-22288
    ORA-06512
    Please help me i'll be thank full.
    Regards
    FAHEEM LATIF
    CREATE OR REPLACE DIRECTORY images AS 'C:\IMAGES';
    CREATE TABLE test007 (column1 BLOB);
    DECLARE
    l_bfile BFILE;
    l_blob BLOB;
    BEGIN
    INSERT INTO test007 (column1)
    VALUES (empty_blob())
    RETURN column1 INTO l_blob;
    l_bfile := BFILENAME('IMAGES', 'MyImage.gif');
    DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly);
    DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
    DBMS_LOB.fileclose(l_bfile);
    COMMIT;
    END;
    /

    I know your original pl/sql routine contained a COMMIT, but did you use the same code with the COMMIT? If not, are you checking the table from a different session?
    I ran your same code and it worked without issues. Are saying if you do a SELECT COUNT(*) from test007 it returns zero rows?

  • Problems importing images into Livecycle Designer 8.0

    Hello all,
    Recently, I have been having problems importing images into the livecycle forms. I put in the image field and link the image but it would just show a broken link symbol. i usually edit the image in photoshop and save as a jpeg. I can't figure out why Livecycle takes some images but not others.
    Please help anyone

    Never mind, I figured it out, have to save files in RGB format, not CMYK

  • Importing images into Lr

    Hi,
    I imported images into Lightroom from a folder I created on my desktop, I got images from Iphoto, and now Lr tells me images are "offline".  I cannot work on them.  I haven't purchased license yet and am using the 30 trial, though I don't thing that should matter.  Please help.
    Thank you,
    Patricia Micaela

    Hey Patricia, yes you can learn lightroom in many ways. One is by going through the below Lightroom Help files.
    http://helpx.adobe.com/lightroom/help/learn-lightroom.html
    Other is through different LR videos present on various sites including Adobe TV and Lynda.com. I was able to gather few of them for you.
    http://tv.adobe.com/show/learn-lightroom-4/
    http://www.lynda.com/search?q=lightroom+4&x=19&y=7&f=producttypeid%3a2%3bmeta_software_fac et%3aLightroom
    Hope that Helps!
    Happy Learning.

  • Importing images into projects

    can any1 please tell me how to import images into my netbeans IDE projects?this should be such that the jar file that is created displays them correctly- i am having this said problem with .jar files.
    plz help!!

    i use a function createImageIcon(ImageIcon icon) wfor which i provide a definition.
    the definition is as given in the java tutorial as follows
    protected static ImageIcon createImageIcon(String path)
    java.net.URL imgURL = LabelDemo.class.getResource(path);
    if (imgURL != null) {
    return new ImageIcon(imgURL, description);
    } else {
    System.err.println("Couldn't find file: " + path);
    return null;
    the program executes perfectly from the IDE when i use the run finction of F6 key. I use netbeans IDE. the images are kept in a folder named images in the 'src' folder of the project. this folder is used to store source files by the IDE. The main thing is i put the images in such a place that the program executes perfectly without errors from the IDE. using the IDE which shows the contents of a .jar file, i verified that the images are indeedd present in the JAR file. however i still continue to get the same error. infact after add ing the images folder and running a 'clean and build' operation , the only difference is that the jar file, which still doesnt display images on buttons, labels etc has increased in size confirming tht the images have been added- i also verified this from the command line.
    but the same problem persists.

  • Just bought an apple iMac went to import music cd only to discover it doesn't have a cd/DVD player can't find any on the apple site what do I need to buy to import cd into ITunes

    ,Just bought an apple iMac went to import music cd only to discover it doesn't have a cd/DVD player can't find any on the apple site what do I need to buy to import cd into ITunes

    Get the Apple USB Superdrive. It is available on the Apple store page of the Apple web site. Just look under storage on the left hand column under accessories for the Mac.  $79.  I have one since I have a lot of DVD's and CD' s. I burn DVD's made from movies created with iMovie.  Works fine. You may be able to find one cheaper at Other World Computing.
    BTW, you can expect that future computers will not have optical disk drives. This is definitely true for Apple and I suspect other mfgrs will also as we move more into streaming video and downloading of apps rather than selling CD/DVD versions.
    BF

  • Is it possible to paste two images into one layer?

    I'm having some issues pasting two images into one layer. Every time I paste the second image, it automatically creates a new layer...is there anyway to prevent that from happening? I'm making an animation on photoshop and I want there to be more than image in some of the frames. Please let me know if you have any suggestions! Thanks!

    You can merge the two layers together once they're position. Select the top layer and choose merge down or select both and choose merge layers (from the layers menu).
    http://help.adobe.com/en_US/Photoshop/11.0/WSfd1234e1c4b69f30ea53e41001031ab64-78b2a.html

Maybe you are looking for

  • Regarding Crystal Reports

    Hi All, I have Created a Crystal Report.This is my Code : Private Sub LoadReport()         Try             FetchData()             FrmCrReportViewer = New FrmCrReportViewer             FrmCrReportViewer.FViewer.DisplayToolbar = True             InsPa

  • Why can't I get a PID to tune without having an offset from setpoint?

    I am using the basic PID algorithm supplied in the PID toolkit and after calculating the terms as described in the manual, my system controls quite well. However, there is about a 2-3 degree offset below setpoint on my heater. I am just starting to u

  • Passing variables from DM to logic script problem (REPLACEPARAM)

    Dear All, I would like to send variables from data manager to a logic script. The script copies values from an account to an other. If I hardcode two accounts in the script, it works fine, but I want to pass these two accounts dynamically from data m

  • How can Sales Group on a sales order be copied from emlpoyee

    We are on SAP 4.7 ERP We have created sales groups G01 G02 We have assigned G02 to emlpoyee JohnD via HR, in table PA0900 We have assigned the sales group to sales office 001 When JohnD creates a sales document for sales office 001 can the sales grou

  • Cds gone

    Hello, I bought Adobe premiere Elements 11 + photoshop elements 11 last year. Now i have changed pc, and want to install these program on the new one. But my Cd's is unfortunately gone! I got the serial code for my purchase. So my question is; Is the