PS Newbie with layer CC translate question

I am a newbie in PS. I am currently using Adobe PS CC, in which I want to merge a number of images to form a 'collage '. These images are already named with coordinates, as (0, 1) .png with size 1280 x 1280 pixels and I all loaded in a photomerge PS document. I guess that each of them is contained in an independent layer, and I can use free transform to move these layers to my position required that these images can be likened to a great image like a puzzle. When the number of layers is important, this hand really is a tedious job. So I want to automate with the script. I try the following script and run it, but without any response. Please correct me as I am new (and also news in JavaScript as well)

# target photoshop


function Main()
{
     MoveLayerTo = function(l, x, y) {
           var b = l.bounds;
           var x1 = b[0].as("px");
           var y1 = b[1].as("px");
           var x2 = b[2].as("px");
           var y2 = b[3].as("px");
           var xc = x1 + (x2-x1)/2;
           var yc = y1 + (y2-y1)/2;
           l.translate(x-xc, y-yc);
        };


  var i = 0;
  var j = 0;
  for (i = -6; i < 3; i++) {
  for (j = 3; j > -11; j--) {
  MoveLayerTo(app.activeDocument.layers.getByName("(" + i + ", " + j + ").png"), new UnitValue(640 +  (i + 6) * 1280, "px"), new UnitValue(640 + (3 - j) * 1280, "px"))
  }
  }
   
}

You said that your script does not respond, what exactly? you get an error message, or is it just do nothing? Just for a few entries, you have a function to run your program, but no line of code to call it. You need a line:

Main()

I would define your rule units at the top of your script and drop all of the code in.as('ps"), just put:

app.preferences.rulerUnits = Units.PIXELS;

The other thing most people do is to define a variable of the loop in the loop, so that it makes it not comprehensive. Your code should look more like this:

# target photoshop 

app.preferences.rulerUnits = Units.PIXELS;
if(app.documents.length>0){
    var doc = activeDocument
    Main ()
    }
else(alert('There are no open files')
function Main()
{
  for (var i = -6; i < 3; i++) {
      for (var j = 3; j > -11; j--) {
      MoveLayerTo(doc.layers.getByName("(" + i + ", " + j + ").png"), 640 +  (i + 6) * 1280, 640 + (3 - j) * 1280)
      } //end j loop
  } //end i loop

function MoveLayerTo (l, x, y) {
          var b = l.bounds;
          var x1 = b[0].as("px");
          var y1 = b[1].as("px");
          var x2 = b[2].as("px");
          var y2 = b[3].as("px");
          var xc = x1 + (x2-x1)/2;
          var yc = y1 + (y2-y1)/2;
          l.translate(x-xc, y-yc);
        };

Tags: Photoshop

Similar Questions

  • Newbie with the mouse event question

    Hello! I started playing with as3, and I have a function for mouse clicks that draws a shape on each click. However, the mouse click event does not appear to work except when I click on a MovieClip, that I placed in the middle of the screen. Is there a way to make the mouse click event recognize when I click anywhere on the screen?

    Thank you

    Will be

    public void newGame()

    {

    Avatar = new Avatar();                                                  Click the mouse entered only when you click on the avatar?

    addChild (avatar);

    avatar.x = mouseX;

    avatar.y = mouseY;

    addEventListener (MouseEvent.CLICK, clickHandler);

    gameTimer = new Timer (25);

    gameTimer.start ();

    }

    you need to add the event listener to the stage

    stage.addEventListener (MouseEvent.CLICK, clickHandler);

    However you must make sure that this step is not null

    If the code above throws an exception to reference null, you'll also need to add and ADDED_TO_STAGE listener

    post the rest of your code and I can help you with that

  • Please help newbie with basic video editing question

    Thanks for the research.  I just bought Adobe first Elements 9 and I'm working on my first project.  All of the videos that I imported for this project were shot on 8mm tape, and they all have a small band at the bottom that shows nothing but the noise or static.  Other that that, they seem to be good.

    Is there a way I can cut the bottom out of these YouTube videos in my production?  Like the place a frame around the video that hides the bottom 1/2 inch of video or so?

    Thank you!

    It's the small space of the transition between the images on the tape does not correctly positioned in the vertical removal interval.

    On some VCRs, there is a setting of framing, but probably not on your camera.

    He normally sees not on old televisions analog because they overscan but flat sacreens now usually show the full frame.

    You can hide in PE9 making the whole slightly larger photo and moving ot slightly downwards.

    Click on the preview area, and you will see a white rectangle with dots in the corners.

    Drag these points around and down to increase the size of the whole image and move the image down so the noise is hidden.

    This will make the image a little more blurry so if you want to keep the same, you can insert a black mask or effect of crops to the place, but it will not show in your finished product. Looking for help with this.

  • I am very new to the software online, please bear with me.  My question is this: I want to create my own designs I want to use for the manufacture of silk scarves.  I have to provide these designs of production of silk professional so they

    I am very new to the software online, please bear with me.  My question is this: I want to create my own designs I want to use for the manufacture of silk scarves.  I'll have to provide professional silk production houses these designs so that they can use my design patterns to create these scarves in silk for retail customers.  What application Adobe should I consider, and I can get a first experimental?  Thanks a lot for your help.  Looking forward to your response.  Best regards, Sunaura

    Hello

    You can try to use Illustrator or Indesign.

    Desktop publishing software | Free download Adobe InDesign CC trial

    Hope that helps!

    Kind regards

    Sheena

  • Apply the Image with layer.id or layer.itemIndex

    Hello

    I want to use the 'Apply Image' function in my JavaScript.
    Because this function is not available in API, I recorded with the 'ScriptListener.8li' function calls
    Here is the code that was generated (I reformatted the code a bit to make it more readable):

    function testIt() {
        var ref24 = new ActionReference();
    
        var idChnl = charIDToTypeID( "Chnl" );
        var idChnl = charIDToTypeID( "Chnl" );
        var idRGB = charIDToTypeID( "RGB " );
        ref24.putEnumerated( idChnl, idChnl, idRGB );
    
        var idLyr = charIDToTypeID( "Lyr " );
        ref24.putName( idLyr, "My Layer Name" );
            
        var desc30 = new ActionDescriptor();
        var idT = charIDToTypeID( "T   " );
        desc30.putReference( idT, ref24 );
    
        var idClcl = charIDToTypeID( "Clcl" );
        var idClcn = charIDToTypeID( "Clcn" );
        var idSbtr = charIDToTypeID( "Sbtr" );
        desc30.putEnumerated( idClcl, idClcn, idSbtr );
    
        var idScl = charIDToTypeID( "Scl " );
        desc30.putDouble( idScl, 2.000000 );
    
        var idOfst = charIDToTypeID( "Ofst" );
        desc30.putInteger( idOfst, 128 );
    
        var desc29 = new ActionDescriptor();
        var idWith = charIDToTypeID( "With" );
        var idClcl = charIDToTypeID( "Clcl" );
        desc29.putObject( idWith, idClcl, desc30 );
    
        var idAppI = charIDToTypeID( "AppI" );
        executeAction( idAppI, desc29, DialogModes.NO );
    }
    

    The problem: the function is based on the name of the layer.
    This can cause problems if two layers have the same name:

    ref24.putName( idLyr, "My Layer Name" );
    

    How can I get this to work of function with 'layer.id' or 'layer.itemIndex '?
    I tried for over six hours and have not found a solution.
    Help, please!

    Something on the lines of.

    function apply(ID) {
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('RGB ') );
    ref.putIdentifier(charIDToTypeID('Lyr '), ID); //Layer ID
    //ref.putIndex( charIDToTypeID('Lyr '), idx ); //Layer Index
    var desc = new ActionDescriptor();
    desc.putReference( charIDToTypeID('T   '), ref );
    desc.putEnumerated( charIDToTypeID('Clcl'), charIDToTypeID('Clcn'), charIDToTypeID('Sbtr') );
    desc.putDouble( charIDToTypeID('Scl '), 2.000000 );
    desc.putInteger( charIDToTypeID('Ofst'), 128 );
    var desc2 = new ActionDescriptor();
    desc2.putObject( charIDToTypeID('With'), charIDToTypeID('Clcl'), desc );
    try{
    executeAction( charIDToTypeID('AppI'), desc2, DialogModes.NO );
    }catch(e){}
    };
    
  • How to show only layers with layer filtering layers?

    Is there a way I can have showing only the layers, files, colors, text, and al. I've worked with in a composition of specific layers in the layer panel? I thought I could achieve with layer filtering, but is the closest with "Selected", the problem is that I lose my folder structure I.

    Thank you in advanced for your help.

    Attribute > Visible (edit: with this layer selected either Comp)?

  • Need help with layer masks

    Hey,.

    I'm trying to follow the tutorial of Rainbow shards from this site: http://blog.signalnoise.com/category/tutorials/

    And I can't understand what to do step 6: I selected the forms below to apply a layer mask to the layer of color '

    Basically, this is the picture in the tutorial:

    i_shardtut_5.jpg

    After a rainbow gradient & a layer masks, this is the result:

    i_shardtut_6.jpg

    Here's my version (sketched) I'm hoping to do the same with:

    Picture1.jpg

    I need assistance with layer masks, I know what they are about but not much about their topic.

    See you soon

    Or convert the layer to a smart object and a clipping mask, the top layer (command-alt-g). Edit: Sorry, I forgot that it is the Windows Forum.

  • BlackBerry Smartphones Newbie with 2 questions, need help.

    Hi guys,.

    hope you can help. I recently bought a BB Curve and think it's great.

    However the LED stopped working. I turned off the unit and removed the battery. When I put it in the LED lights up red, so it must work. I checked my profile settings and all say that the LED must be on. I have changed this setting to disabled, backed up, and then put it back on and saved and still no action led.

    The second question is attachments on my emails. I can't open attachments, photos, documents spreadsheets nothing. I use desktop re-Director. Is it possible to have attachments that are sent using this unit or any other bits of software? I have the only BB at work so I'm not so sure, establishment of a BB server is viable.

    Your opinion would be greatly appreciated.

    There is not all the configuration parameters for the Service of the attachment. The following table describes the supported types of attachments on a BlackBerry

    http://www.BlackBerry.com/BTSC/KB03265

    By default the LED flashes green to indicate that you are in a wireless coverage area. I found it annoying and disabled. Check the setting under Options | Screen/keyboard and turn the LED coverage indicator inactive.

  • Profile of Newbie Xcode provision of the question and problem recording peripheral Dev Member Center

    Help!  I am a user of Xcode newbie. Just signed up for a developer account (free version added to my existing Apple ID).   I followed a tutorial to make a few changes to the Apple TV 4. In the tutorials that seem very useful do not have additional info for potential problems as those I seem to face at every turn. As far as google can be useful, it can also be a time suck empty soul.  I have a life to live then all help to speed up the answers to these questions would be greatly appreciated.

    -Launch Xcode → click on create a new project in Xcode → select Application under tvOS → Application unique view, and then click Next. Fact

    - In the product name field, enter a unique name such as KodiAppleTVforYourNameHere (done, but I have a problem I can not find the answer to...), and then click Next → create

    The 'organization' identifier is empty and I do not know what to enter and the tutorial says nothing...

    - In the drop-down box team, select your personal team and click the question difficulty to solve problems of commissioning. You will ensure that you are connected to Xcode with a free Apple Developer account. You can learn how to do it using this tutorial.

    I get a "no provisioning profiles found.

    When you click on "solving the problem", I get a pop up saying "no device - create a profile doesn't require" fitted with a registered in space subscribers.

    Then I went to the Member Center and can not find the place where to save a device... nor can I find detailed (for a novice like me) instructions on how to do it.  I tried to follow these instructions, but had problems as shown below.

    1. go to Developer.apple.com...

    2. go in the "Member Center". (This is not an option that I see...)

    3. go in "Certificates, identifiers & profiles." (Went straight to this...)

    4 Select "Devices" on the left navigation. (nowhere to be found... and am stuck here...)

    .... 5. click on the sign "+" to add a device.

    .... 6. enter a name for the device and the UDID.

    .... 7. at the bottom of the page, select continue when you are finished.

    .... 8. at the bottom of the page, choose "Save" to save the new device. Repeat these steps to add up to 100 devices on a regular account.

    These steps seem easy enough, but I continue to find myself in a position that some things I should do just are not there... like the devices section not found in the center of development Member?

    Help or direction would be greatly appreciated.  Thank you!

    Have you ever this resolved? I'm having the same problem.

  • Please help a newbie with a video make the problem!

    IM new to After Effects, so please forgive if this is a silly question.


    I have an Animation of edge with a background color of #ffa800

    I imported a video after affects that has a transparent background.

    Research tells me that the video is never really transparent, so I'm creating a solid layer in AE, placing video on it and setting the blend mode 'screen '.

    I now have a video with a background color of the #ffa800.

    However, when I export / view the video output and import in my project of edge to animate the background color of the video is disabled and does not match my background of edge animate.

    I spent all day experimenting with different export made direct EI options and also through Media encode. IM now completely stumped.

    I also tried setting the video background color #ffa800 and masking then my video. It keeps me from having to use a "screen" blend mode, but I get the same exact results.

    Could someone please give me some advice on where I'm wrong please. The bottom is so close, but either slightly darker or more clear that I put that spoils the overall animation effect I want to create.


    Thank you


    Paul

    Lack of information exact system, rendering settings and so forth person can tell you a lot. That said, there are a few fundamental failures in your plan. First of all, web colors do not mean anything in AE or in most graphics programs than elsewhere because of the object of little quantification management and possibly color errors. Whatever colors you compose, do it using the normal RGB sliders. Second, blend modes are not transparency, even if for mathematical reasons, the formula mixture may appear to eradicate certain colors. Third, you must take into account the values of Gamma. Video is not linear mixture and time your screen of computer as well as the video content itself may have a built-in Gamma value. Thus, your merge operation could already produce erroneous results as a light mist, the encoding of the video file could introduce Gamma tilt and then finally in the last step, any tool that you use to view perhaps apply dynamic corrections thus or in reverse, not at all. So this is essentially to check these things and properly calibrate / setting of your monitor and your system color settings and make use of color in AE management, if any. However, in the end, you always see minor deviations of color. It is inherent in how compressed formats like H.264 work. You can only try to minimize as much as you can.

    Mylenium

  • Help with layer of Action &amp; buttons

    I have a flash banner which contains "clickTAG" instructions in the actions layer (above). Also on this layer, I put the invisible button that the user clicks on to invoke the "clickTAG". My question is, can I have a button on the layer actions? Should be on a separate layer? The button will work if it is?

    Thanks in advance,

    Beginner in Flash

    you assign your button a unique instance in the properties panel name, for example btn1.   in your code, you reference btn1:

    AS2:

    {btn1.onRelease = Function ()}

    No matter what

    }

    AS3:

    Btn1.addEventListener (MouseEvent.Click, f);

    function f(e:MouseEvent):void {}

    No matter what

    }

    Is the name of the instance (in this example btn1) which allows flash to tie one on stage clash with the code.  It's not ' matter which layer is the button in and it doesn't matter which layer the code is in.

  • newbie on a vi Lottery question

    I was through the forum and found a few ways to do this, but I have a problem of table: I put mine to generate five initials and door numbers upward award-winning "powerball", but my question is how can I get the table five to see each number in another cell of the table, rather than in each cell at the same time. I think I need a constant matrix somewhere, but with a while loop in the loop for, I'm not coming with the desired operation.

    Here is a copy of my vi and a picture of the "spaghetti".

    Also, I use on my student edition 9 version.

    Thanks for any help.

    Emmanuel says:

    • generate random #s up to 40
    • 1 d is looking to repeat no #s in the shift register
    • AND the results obtained with the elapsed timer and the construction of the table
    • table size = 5, stop vi.

    There are several problems with your version:

    • You create random numbers instead of 1.40 0.39
    • Given that the elapsed time resets whenever it times out, it will have 3 seconds more each time a duplicate is found. For example, it will take 6 seconds between numbers if a double is on the first attempt and 9 seconds if two duplicates are found, etc.
    • You're creating random numbers every 100ms, but throw all until the moment where also elapsed.

    Here is a quick alternative to your code.

  • Problems with e-mail &amp; phone questions

    I'm new to the Droid X and have questions about e-mail and phones & I can't seem to locate an FAQ answering my questions. I hope someone can.

    First how can I manually send an email.

    Emails with attachments storing to view later.

    Where was listed phone calls.

    Where are the calls listed?

    Thank you

    Steve

    In K - 9, there are different settings for each account. The Inbox of the account or tap the record screen:

    Menu-> more-> settings-> account-> Notifications settings

    Turn on notifications, and then select the option of vibration. Now type the new mail ringtone and select muffler. If you don't have a built-in silent ringer, I have attached a that you can copy to your phone. Put it in a folder called "notifications" on your SD card. This file may already exist in media/audio/notifications.

    You will need to do this for each account that you have configured in K - 9.

    ----
    I'm a volunteer.  I own a Backflip and a setback. If my opinion doesn't have any sense - ignore it! The MotoXprt tag means that I spend too much time here. The views expressed in my posts are mine. Here's more

  • Keyboard for Smartphones blackBerry with three languages + other question

    Hello, question about the keyboard. I've used for several years, both physical KB (z30) virtual bb10 KB (passport - best physics kb). Something that both got kb was very well the ability to write in several languages at the same time, in the sentence, and the Ko magically would correctly identify what language I was using and could give me any suggestions according to this and more important still, if one has been written in English but then type something in my second or third language , will not auto correct. Now, I have a private and I have these two questions:
    1. - I can not type in several languages at the same time without changing the language first. I put the three I use most, but all the suggestions and auto correct options are in the main language only. I'm surprised because this has been well implemented with bb10 and yet a BlackBerry smartphone. Any suggestion?
    2 - for some reason, in mid sentence, a word would have the first capital letter, just the option in the space bar is the same word I wrote, but with a capital letter. Boring.

    Any help would be much appreciated, thanks!

    Sorry for the late reply, I didn't know you posted a suggestion... I had put everything in settings multilingual, but did not work. However apparently, in android, there's the thing that I found in another forum so let me add here... I followed these instructions step by step and now I have a kb truly multilingual, with automatic detection... some steps I've done it before with no luck but to do all in sequence... If you previously installed the multilanguage, delete it and start from scratch:

    1. install and activate the BlackBerry keyboard
    * Go to the language and entry
    * Go to "default keyboard / current keyboard", press "configure the inputs.
    method' and activate the BlackBerry keyboard
    * Select BlackBerry keyboard as default keyboard

    2 configure the keyboard
    * Under the keyboard and input methods, tap on the BlackBerry keyboard
    * Press on multilingual keyboard
    * Choose your main language (which is in German) and the secondary
    language (IE. US English)
    * Press on save at the top right and click on "activate now".
    * You will now see a dialog language. Disable 'language use of the system '.

    AND NOW COMES THE BIG THING:
    * In the language list that is displayed, you will notice that your
    main language is listed TWICE (in my case GERMAN and just below a
    second GERMAN. Select the SECOND ENTRY and DO NOT select your
    language school (in my case English of the United States) in the list.
    * Press return to save the configuration

  • BlackBerry Smartphones quite confused newbie with (iMac) &amp; Blackberry Curve 8530 ordered

    I thought I posted this before but can't ind station. Maybe I'm in the wrong bench?

    Need to synchronize information on BB Curve 8530 with my iMac, Mobile me up and use to sync iPod Touch - questions are:

    1 can I disable MM before you install Blackberry software for Mac (Snow Leopard)?  I need to be able to sync contacts/address book, iCal with the new phone and am afraid of conflicts so I don't "disable Mobile Me.

    2 have you also looked at Mark/Space software to sync Curve 8530 - it might be a better program to sync with iMac - someone uses this or do you use the Balckberry software?

    3. do I have on the right forum for these questions I changed my subscription and I am in the right but not sure, so pls be kind enough to redirect me...

    thx for your patience.

    Hello, petunia

    Before you install the BlackBerry Desktop Software I would recommend support to the top of your address book and iCal on your Mac. Do this please open your address book, and then select the file (in the top menu) > export > Address Book Archive, and then click Save and placed on the desktop. Let then open iCal and select file > export > iCal Archive and click Save to place them on the desktop as well.

    You are now ready to install the BlackBerry Desktop Manager on your Mac. You don't need to disable mobile me to do this. After installation, restart your Mac and open the app to BlackBerry Desktop manager (it will be located in your main applications on the Mac folder). Follow the on-screen instructions to connect your smart phone BlackBerry for Mac.

    After the device is recognized and connected, you will have to configure synchronization settings. To do it please click on the items you want to synchronize under information and then select two way to sync with the calendar to sync or Sync Contacts(In the middle of the page). Once this operation is complete, you can go ahead and click the sync button located on the top right to start the synchronization process. During synchronization it will alert you that it's your first synchronization and it is recommended to replace the data on the BlackBerry smartphone. Please select this option to overwrite the data so that all the information of iMac you will be synchronized on your BlackBerry Smartphone.

    Once it is complete, you can eject your BlackBerry Smartphone by pressing the key of eject located in the lower right of the program.

    Thank you and you defenatly in the right place!

Maybe you are looking for

  • All software/programs reinstall it from a backup hard drive?

    I just bought my wife a MacBook Pro computer refurbished GroupOn.  It was made in 2012.  She has an old computer MacBook 2008.  We did a full backup on an external hard drive.  All software/programs installed will be reinstall from this backup?  We d

  • How can I change the language of Windows Vista on Satellite A300-1CO

    last summer, I was in the Portugal and I bought a laptop Toshiba A300-1CO in hopes that we can to change the language to English or Roman without reinstalling Windows. Can someone help me?

  • All of a sudden my speakers, with helmets and stopped working so I have no sound.

    I have a Pavilion dv6 with beats audio and Windows 7 home.   All of a sudden I turned on my computer one day and had no sound at all.  I did not load something again and has not done something again.

  • Search for all Instances of script

    Hello, I was wondering if there was a way to programmatically use the find all Instances with scripts?  At the moment my work around is very slow, but works. I have a reference to a VI and I have my open project, then I want to find all the places th

  • Inspiron 545 CPU Upgrade, E5300 to E8400

    Currently, I own an Inspiron 545 and was studying the processor upgrade. This computer is used as a HTPC + games Current processor is Pentium Dual Core E5300 2.6GHz, bus front at 800 MHz. LGA 775 Motherboad is DG33M06, wood version A12 I was watching