How to automate cropping of selection?

Hello

I a m looking for an overall process,

I want to automate a culture of choice, regardless of the size of the selection

The problem if I record an action, the specific limits, which only works for one specific size...

I need to preserve the cropped pixels...

Thanks for helping!

This give a try.

#target photoshop;
if(documents.length) cropToSelection();

function cropToSelection() {
try{
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
var SB = activeDocument.selection.bounds;
var desc14 = new ActionDescriptor();
var desc15 = new ActionDescriptor();
desc15.putUnitDouble( charIDToTypeID('Left'), charIDToTypeID('#Pxl'), SB[0].value );
desc15.putUnitDouble( charIDToTypeID('Top '), charIDToTypeID('#Pxl'), SB[1].value  );
desc15.putUnitDouble( charIDToTypeID('Rght'), charIDToTypeID('#Pxl'), SB[2].value  );
desc15.putUnitDouble( charIDToTypeID('Btom'), charIDToTypeID('#Pxl'), SB[3].value  );
desc14.putObject( charIDToTypeID('T   '), charIDToTypeID('Rctn'), desc15 );
desc14.putUnitDouble( charIDToTypeID('Angl'), charIDToTypeID('#Ang'), 0.000000 );
desc14.putBoolean( charIDToTypeID('Dlt '), false );
desc14.putEnumerated( stringIDToTypeID('cropAspectRatioModeKey'), stringIDToTypeID('cropAspectRatioModeClass'), stringIDToTypeID('unconstrained') );
executeAction( charIDToTypeID('Crop'), desc14, DialogModes.NO );
}catch(e){
    alert("There is no selection!");
    }
finally{
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
    }
};

Tags: Photoshop

Similar Questions

  • How can I stop iMovie automatically crop my picture?

    I make an invitation left in iMovie, a single pdf file, set to music.  iMovie has automatically "cropped" my pdf, slowly zooming in on the center of the image, which means that I lose the information around the edges.  How do I stop iMovie automatically crop and zoom - I want just the full-size PDF to show?

    Looks like you have the ken burns effect turned on. Select your pdf file and click the crop button in the toolbar. Then select adjustment and you should be fine.

  • How to automatically create a rectangular layer from a selection of irregular shape mask?

    I'm trying to automatically crop images. The subject is on a white background and extends between the left edge of the image to the right. The top and bottom of the object are in the frame. I need to crop a certain distance from the top and at the bottom of the topic and a predefined width which would be calculated from the height of the subject.

    My current idea is to create a duplicate layer and run the threshold on this, that allows me to choose the topic clearly. Once I have the selected object, I use Image-> cultures to create the desired rectangle, but I can't find a way to create a mask for the selected object in an irregular way. Anyone know how to take a selection and convert it into a rectangle? I hope this makes sense, I try to explain better if not. Thank you.

    -Chris

    // make selection rectangular;
    // 2013, use it at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
    var myDocument = app.activeDocument;
    try {
    var theBounds = myDocument.selection.bounds;
    var theArray = [[theBounds[0], theBounds[1]], [theBounds[2], theBounds[1]], [theBounds[2], theBounds[3]], [theBounds[0], theBounds[3]]];
    myDocument.selection.select(theArray, SelectionType.REPLACE, 0, false);
    }
    catch (e) {}
    };
    
  • Sound suddenly stopped automatic cropping, how can I solve this?

    So I worked on a project for some time and it is quite comprehensive, so I won't do it again to solve my problem:

    I am text cutting or videos with Mark automatic cropping which appears when I'm mower or do drag & drop of files. That'w how I now that everyone is in sync. Now, suddenly, there is no marker more to jump automatically the compensation to be synchronized with the playback head or other files! Usually he should at least have a cursor and the file jumps a bit to the next available cut, but he simply stopped mid-project. How can I solve this problem? I don't want to start a new project, or stay here more that I wouldn't otherwise just to cut the stuff manually...

    Thanks for all the help I can get...

    You clicked the magnet symbol top left of the timeline? or its shortcut (but I don't remember what it is)

  • crop to selection in action while maintaining the cropped pixels

    Hello

    Is it possible to use the image > crop without deleting pixels outside that culture?

    I have a lot of images with a shadow I want to crop by using their path (selection)

    I do a deed which

    -selects the path (all named ' 1') of an image

    -image > crop the image to this selection

    In this way, the ratio is not contained in the action, BUT the pixels outside of the selection are removed. How do you define culture pixels cropped remember?

    Note: double click on the crop tool will give me the opportunity to uncheck 'delete pixels' but will contain the report of the harvest, making my action null.

    Thanks for your help

    Vanessa

    Ideally, I guess we should create a Script (in JavaScript).

    What structure in a layer?

    If there is only one layer to change it to a smart object, then using Image > Crop (with selection) might be an alternative.

  • How do you crop one picture now that there's no magic wand

    How do you crop one picture now that there's no magic wand

    There is a magic wand tool unless I'm missing something in your question.  Use SHIFT - W or select in the right group of doubleclicking and held:

  • How to use the Multiple selection in ADF faces

    I have, I want to know how to use a multiple selection (ADF select several choices) for updating the database.

    by mentioning your exact jdev version.

    As far as I know he in not possible automatic update select a choice that she returns a list which you must map back to the lines of the table yourself.

    Timo

  • How do I crop an image

    Can u please suggest me how can I crop an image by photoshopping

    Usually, you would open an image, select the crop tool in the tools Panel, and then draw a rectangle around the part of the image you want to keep.  Adjust the edges until you see, is just to the right and then click the check mark button or press ENTER.

    -Christmas

  • How to automate consistent operations CDC?

    Hello
    I am trying to configure an ETL/ELT infrastructure and use CDC consistent logging set for gradual integration
    I read this "User Guide", in particular the chapter titled as 'change data Capture.
    But I still don't know how to automate this process

    specifically, in this paragraph:
    -----------
    To create a step of window extend, Subscriber of lock/unlock or log purge in a package:
    1. open the packaging where the operations will be performed.
    2. drag and drop the model for which you want to perform the operation.
    3. in the Type list, select logging model.
    4. check the radio buttons corresponding to operations to be performed.
    5. Enter the list of subscribers in the Group of the subscribers if the operation of locking/unlocking subscribers.
    Click OK.
    ------------
    which means in step 4?

    I followed these instructions and tried in "Getting started - ETL" demo of the project
    I created a new package and dragged model 'Orders Application - HSQL' inside
    then I changed to Type "Model Jounalizing" as Step 3a indicated
    After that, a new tab named "Journaling" appeared
    I went to this tab and everything that I've seen is:
    ! http://i694.Photobucket.com/albums/vv310/__void__/2009-7-916-19-54.PNG!

    I tried these box, it seems only fair, they relate to the CDC infrastructure subscribers Configuration add/delete operations and does not 'Extend window, locking/unlocking Subscriber or Purge Journal' operations
    what I want to do this step is like what he does when I right click on a model and select "Change Data Capture > consumer > expand window" etc. (as the next pic shows)
    ! http://i694.Photobucket.com/albums/vv310/__void__/2009-7-916-51-17.PNG!

    so I can configure a package to do these steps:
    1 extend the window
    2 lock subscribed
    3 ELT/ETL processing for only the logged data
    4. unlock the Subscriber
    5 empty Journal


    so, how can I do this?


    Thanks in advance
    any help is appreciated

    Hello

    Maybe this post CDC in ODI
    help, it contains links to instructions step by step for DCC.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • How to disable all the selections at once?

    How to disable all the selections at once?

    If you are referring to the playlist, artist, album & kind selection boxes, then I don't think that there is a way to uncheck those all at once.

    If you mean the boxes in the view of songs Ctrl + click and the checkbox to check or uncheck all of the boxes. Note, however, that the use of these boxes is a bad way to manage the synchronization. Uncontrolled songs are ignored in the normal course of track in track or shuffle playback. Better to use one or more playlists to control what is synchronized and have checked most, if not all of your library. Items not controlled in my library are things like interview bonus tracks that had never what to hear accidentally, I keep in my library.

    TT2

  • How to automate the cutting through a visual basic 6.0 application tool?

    Original title: Visual basic 6.0

    How to automate the tool to cut through a visual basic 6.0 application. Or my visual basic 6.0 application is to take screenshots and save them as gif images, but the files are too big and take a long time to be sent by e-mail in real time. Please if someone could help, need a code in visual basic 6.0 to make these small files.

    Hello

    You can get support for development on the MSDN Forums tools.

    MSDN forums: Index

    http://social.msdn.Microsoft.com/forums/en-us/categories

    Concerning

  • How to automate ScanDisk using Task Scheduler tool?

    There is no file c:\windows\scandskw.exe on my XP, does anyone have any suggestions on how to automate using Task Scheduler tool in XP ScanDisk?

    Thanks for all the suggestions

    Saturday, August 14, 2010, 02:18:45 + 0000, SC Tom wrote:

    There is no program Scandisk in Windows XP.

    In order to specify that the person you are you answer to the. There is no program
    called the Scandisk, but there is a program with this feature; There
    Called Chkdsk.

    Ken Blake

  • I cannont turn on automatic updating. I have is gray. Disable the automatic update is selected but also gray and selected.

    I cannont turn on automatic updating.  I have is gray.  Disable the automatic update is selected but also gray and selected.

    you have the service disabled?

    Click Start > run > type in services.msc box and Microsoft Management Console will be open.

    Search for automatic updates. Right-click the line, and then click Properties. In the dialog that opens, make sure Startup Type is automatic. Click on apply. Wait for it. Then click Start under Service status. You will see another pop-up window but it is a progress bar. If the service does not start, you will get an error. Otherwise, you will see wuauserv in the Task Manager. You should also see the yellow shield which shows you download updates. Also check your Windows Firewall and third-party firewall installed on the machine. Another place is the router/modem. You may need your ISP to help with the party.

  • How can disable us the selection of lines under condition

    Hi Experts,

    JDEV version 12.1.3.0

    How can disable us the selection of lines under certain conditions.

    As the lines newly unregistered should be allowing the selection of lines.

    Saved lines should be disabled from the selection.

    Can achieve us.

    Please me advice accrdingly

    Thank you

    Roy

    You are implementing a generic selection as shown here http://www.oracle.com/technetwork/developer-tools/adf/learnmore/23-generic-table-selection-listener-169162.pdf Manager in this handler, you check and validate the selection of our not.

    Timo

  • If I have the two LOV in the same table then how to connect when I select first and second LOV value also change?

    Mr President

    If I have the two LOV in the same table then how to connect when I select first and second LOV value also change?

    My two fields are FLOW AND DR_NAME

    FLOW = ACCT_ID

    DR_NAME = ACCT_NAME

    I created with success of LOV for these fields.

    First LOV gives acct_id in the debit field and second LOV gives the value of acct_name to dr_name.

    How can I report these lov, it's that when I change my acct_id then acct_name also change

    I have these two tables

    CREATE TABLE "NOM"  (
      "ACCT_ID" VARCHAR2(7) NOT NULL ENABLE, 
      "ACCT_NAME" VARCHAR2(50) NOT NULL ENABLE, 
      "O_BAL" NUMBER(13,2),
      CONSTRAINT NOM_PK PRIMARY KEY ("ACCT_ID")ENABLE
       
       );
    CREATE TABLE "VOUCHERDET" (
      "V_ID" VARCHAR2(9) NOT NULL ENABLE,
      "LINEITEM" NUMBER ,
      "DEBIT" VARCHAR2(7) , 
      "DR_NAME" VARCHAR2(50), 
      "CREDIT" VARCHAR2(7) , 
      "CR_NAME" VARCHAR2(50), 
      "PARTICULARS" VARCHAR2(100), 
      "AMOUNT" NUMBER(21,2),
    CONSTRAINT VOUCHERDET_PK PRIMARY KEY ("V_ID","LINEITEM")ENABLE, 
    CONSTRAINT PUR_SAL_LINE_POD_FK FOREIGN KEY(PROD_ID)
      REFERENCES PRODUCTS (PROD_ID)ENABLE,  
    CONSTRAINT VOUCHERDET_DEBIT_FK FOREIGN KEY ("DEBIT")
       REFERENCES "NOM" ("ACCT_ID") ENABLE, 
    CONSTRAINT VOUCHERDET_CREDIT_FK FOREIGN KEY ("CREDIT")
       REFERENCES "NOM" ("ACCT_ID") ENABLE,  
    CONSTRAINT VOUCHERDET_V_FK FOREIGN KEY ("V_ID")
       REFERENCES "VOUCHER" ("V_ID") ON DELETE CASCADE ENABLE
      );
    
    

    Concerning

    so, instead of this second ActId, choose ACCT_NAME:

Maybe you are looking for