Pages: [1]   Go Down

Author Topic: Identical Crops To Multiple Images - How???  (Read 2196 times)

Mort54

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 590
    • http://
Identical Crops To Multiple Images - How???
« on: August 12, 2007, 02:45:34 pm »

I need to apply an identical crop to multiple images - how do I do that? The crops aren't simple rectangles. I've got the perspective option checked and my crops have been shaped into trapezoids for perspective correction, so I can't easily recreate the exact same trapezoid from image to image. The crops have to be exact, so I need some kind of copy and paste, or something analagous. Is there a simple way to create a crop for one image, and then apply the identical crop to other images?

I should add that all of the images are fully registered with each other. They only differ in shutter speed.

Any help would be appreciated,
Mort.
Logged
I Reject Your Reality And Substitute My

John Hollenberg

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1185
Identical Crops To Multiple Images - How???
« Reply #1 on: August 12, 2007, 04:29:40 pm »

There are two ways I can think of offhand to accomplish this:

1) Put all the images as separate layers in a new document and then apply your crop.  Take the cropped layers and put them in separate documents.

2) Use the scriptlistener plugin to record your crop, then go to the text file where the script is stored and extract the relevant portion to create a javascript file.  Run the resulting script on each image.

Both techniques appear to work here in a quick test.  Don't know if the scriptinglistener script is specific to a particular platform (Mac or PC) or a specific computer configuration, but here is the script I got which appears to work here:

// =======================================================
var id3 = charIDToTypeID( "Crop" );
    var desc2 = new ActionDescriptor();
    var id4 = charIDToTypeID( "T   " );
        var desc3 = new ActionDescriptor();
        var id5 = charIDToTypeID( "Cntr" );
            var desc4 = new ActionDescriptor();
            var id6 = charIDToTypeID( "Hrzn" );
            var id7 = charIDToTypeID( "#Pxl" );
            desc4.putUnitDouble( id6, id7, 2097.500000 );
            var id8 = charIDToTypeID( "Vrtc" );
            var id9 = charIDToTypeID( "#Pxl" );
            desc4.putUnitDouble( id8, id9, 1427.000000 );
        var id10 = charIDToTypeID( "Pnt " );
        desc3.putObject( id5, id10, desc4 );
        var id11 = stringIDToTypeID( "quadCorner0" );
            var desc5 = new ActionDescriptor();
            var id12 = charIDToTypeID( "Hrzn" );
            var id13 = charIDToTypeID( "#Pxl" );
            desc5.putUnitDouble( id12, id13, 848.960271 );
            var id14 = charIDToTypeID( "Vrtc" );
            var id15 = charIDToTypeID( "#Pxl" );
            desc5.putUnitDouble( id14, id15, 300.834758 );
        var id16 = charIDToTypeID( "Ofst" );
        desc3.putObject( id11, id16, desc5 );
        var id17 = stringIDToTypeID( "quadCorner1" );
            var desc6 = new ActionDescriptor();
            var id18 = charIDToTypeID( "Hrzn" );
            var id19 = charIDToTypeID( "#Pxl" );
            desc6.putUnitDouble( id18, id19, 3443.441860 );
            var id20 = charIDToTypeID( "Vrtc" );
            var id21 = charIDToTypeID( "#Pxl" );
            desc6.putUnitDouble( id20, id21, 276.441595 );
        var id22 = charIDToTypeID( "Ofst" );
        desc3.putObject( id17, id22, desc6 );
        var id23 = stringIDToTypeID( "quadCorner2" );
            var desc7 = new ActionDescriptor();
            var id24 = charIDToTypeID( "Hrzn" );
            var id25 = charIDToTypeID( "#Pxl" );
            desc7.putUnitDouble( id24, id25, 3541.000000 );
            var id26 = charIDToTypeID( "Vrtc" );
            var id27 = charIDToTypeID( "#Pxl" );
            desc7.putUnitDouble( id26, id27, 2854.000000 );
        var id28 = charIDToTypeID( "Ofst" );
        desc3.putObject( id23, id28, desc7 );
        var id29 = stringIDToTypeID( "quadCorner3" );
            var desc8 = new ActionDescriptor();
            var id30 = charIDToTypeID( "Hrzn" );
            var id31 = charIDToTypeID( "#Pxl" );
            desc8.putUnitDouble( id30, id31, 601.000000 );
            var id32 = charIDToTypeID( "Vrtc" );
            var id33 = charIDToTypeID( "#Pxl" );
            desc8.putUnitDouble( id32, id33, 2854.000000 );
        var id34 = charIDToTypeID( "Ofst" );
        desc3.putObject( id29, id34, desc8 );
    var id35 = stringIDToTypeID( "quadrilateral" );
    desc2.putObject( id4, id35, desc3 );
    var id36 = charIDToTypeID( "Wdth" );
    var id37 = charIDToTypeID( "#Pxl" );
    desc2.putUnitDouble( id36, id37, 0.000000 );
    var id38 = charIDToTypeID( "Hght" );
    var id39 = charIDToTypeID( "#Pxl" );
    desc2.putUnitDouble( id38, id39, 0.000000 );
    var id40 = charIDToTypeID( "Rslt" );
    var id41 = charIDToTypeID( "#Rsl" );
    desc2.putUnitDouble( id40, id41, 600.000000 );
executeAction( id3, desc2, DialogModes.NO );

You can try copying this text to a file you name crop.js and put that file in the \presets\scripts\ directory under Photoshop CS2 (what I used to make the script).  Then try running it from the File -> Scripts menu.

Edit: This file can only serve as an example, because the coordinates are hard-coded into it.  To use this method effectively, use the scriptlistener plugin (which was surprisingly easy to do).

Good luck.

--John
« Last Edit: August 12, 2007, 06:54:39 pm by John Hollenberg »
Logged
Pages: [1]   Go Up