How do I crop with "delete cropped pixels" unchecked in a script

I need to use crop feature with "delete cropped pixels" unchecked in a script.  Is that possible?
Thanks,
Tom

This uses the Array from a Selection, but you can also just set the numbers in the Script.
/* 2013, use it at your own risk */
#target photoshop
if (app.documents.length > 0) {
activeDocument.suspendHistory('cropping', 'main()')
////// the operation //////
function main () {
var myDocument = app.activeDocument;
// set to pixels;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var originalResolution = myDocument.resolution;
myDocument.resizeImage(undefined, undefined, 72, ResampleMethod.NONE);
// get selection bounds;
var theArray = myDocument.selection.bounds;
cropImage (theArray);
// reset;
app.preferences.rulerUnits = originalRulerUnits;
myDocument.resizeImage(undefined, undefined, originalResolution, ResampleMethod.NONE);
////// crop image //////
function cropImage (theArray) {
// set to pixels;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// =======================================================
var idCrop = charIDToTypeID( "Crop" );
    var desc7 = new ActionDescriptor();
    var idT = charIDToTypeID( "T   " );
        var desc8 = new ActionDescriptor();
        var idTop = charIDToTypeID( "Top " );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc8.putUnitDouble( idTop, idRlt, theArray[1] );
        var idLeft = charIDToTypeID( "Left" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc8.putUnitDouble( idLeft, idRlt, theArray[0] );
        var idBtom = charIDToTypeID( "Btom" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc8.putUnitDouble( idBtom, idRlt, theArray[3] );
        var idRght = charIDToTypeID( "Rght" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc8.putUnitDouble( idRght, idRlt, theArray[2] );
    var idRctn = charIDToTypeID( "Rctn" );
    desc7.putObject( idT, idRctn, desc8 );
    var idAngl = charIDToTypeID( "Angl" );
    var idAng = charIDToTypeID( "#Ang" );
    desc7.putUnitDouble( idAngl, idAng, 0.000000 );
    var idDlt = charIDToTypeID( "Dlt " );
    desc7.putBoolean( idDlt, false );
    var idcropAspectRatioModeKey = stringIDToTypeID( "cropAspectRatioModeKey" );
    var idcropAspectRatioModeClass = stringIDToTypeID( "cropAspectRatioModeClass" );
    var idunconstrained = stringIDToTypeID( "unconstrained" );
    desc7.putEnumerated( idcropAspectRatioModeKey, idcropAspectRatioModeClass, idunconstrained );
executeAction( idCrop, desc7, DialogModes.NO );
// reset;
app.preferences.rulerUnits = originalRulerUnits;

Similar Messages

  • As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 also how we can insert,update,delete records in list using ECMA script.

    As i am fresher Please share the doc of ECMA script using java script in SharePoint 2013 step by step also how we can insert,update,delete records in list using ECMA script.
    Thanks and Regards, Rangnath Mali

    Hi,
    According to your post, my understanding is that you want to use JavaScript to work with SharePoint list.
    To create list items, we can create a ListItemCreationInformation object, set its properties, and pass it as parameter to the addItem(parameters) function
    of the List object.
    To set list item properties, we can use a column indexer to make an assignment, and call the update() function so that changes will take effect when you callexecuteQueryAsync(succeededCallback,
    failedCallback). 
    And to delete a list item, call the deleteObject() function on the object. 
    There is an MSDN article about the details steps of this topic, you can have a look at it.
    How to: Create, Update, and Delete List Items Using JavaScript
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to update Cube witha deletion of a record in ECC

    Hi
      I am extracting Data from ECC using a ZZ Datasource based on a View
    Data Flow in BW
    ECC(ZZ EXTractor)-->DSO1(Full)->DSO2(Delta)----.Cube(Delta)
    Scenario:
    Lets say today i loaded Records A,B,C,D to Cube
    In ECC C & D Records are deleted
    How can i replicate those deletions in CUBE
    Thanks

    if you do a complete full load from r/3 to your dso1 (assuming it's not W-O), then with the activation of the dso request, the generated delta will contain the deletion of the two records (ie all KF put to 0). your next delta will be correct. if you actually want to delete the line from cube, i think you have no other option then to do full delete of the cube data and only do full loads from T/3 to cube
    M.

  • Cube Compression - How it Affects Loading With Delete Overlapping Request

    Hi guys,
    Good day to all !!!
    Our scenario is that we have a process chain that loads a data to infocube and that has delete overlapping step. I just want to ask how does the cube compression affects the loading with delete overlapping request. Is there any conflict/error that will raise? Kindly advice.
    Marshanlou

    Hi,
    In the scenario you have mentioned:
    First the info cube would be loaded.
    Next when it goes to the step i.e delete overlapping request:  in this particular step, it checks if the request is overlapping (with the same date or accd to the overlapping condition defined in the infopackage, if the data has been loaded). 
    If the request is overlapping, then only it deletes the request. Otherwise, no action would be taken.  In this way,it checks that data is not loaded twice resulting in duplicasy.
    It has nothing to do with compression and in no way affect compression/loading. 
    Sasi

  • How Use Multi Pages with JSP pages

    I have a lot of records, so i want to display from 10 to 10 and use a numeric menu in the botton of the page. the problem is how a make that with java code and html or java script.
    thanks for your help
    LeonMex. from M�xico City

    Search for pager taglibs. Ur solution lies there.
    Moreover u can refer www.jsptags.com , I am using the pager taglib from jsptags and it's quite easy to use.
    Hope that Helps.
    thanks and regards.

  • How to save layers with cropping?

    I want to export layers to files (basically what "Export Layers To Files.jsx" does) but with cropping each layer (to different sizes). I know how to crop a document from script, but that also crops all other layers (erases their content outside of the cropping area). So my question is - how do I keep/retrieve the cropped out content of the document (layers)? Or maybe there's a better approach altogether?

    Seems to me that you only need to keep the cropped pixels because of way you want to do this.
    However if you want to do it this way you could create a history snapshot, crop and save the first layer. Then restore the document using the snapshot and crop and save the second.
    Or you may be able to just store the current history state in a variable then restore the document using that history state if you are only using a few history states to crop and save.
    With a snapshot you don't have to worry about the number of history states but it needs action manager. Storing the current history state can be done using the DOM.

  • How do I crop a PDF with Preview.

    How do I crop a PDF with Preview.
    For some strange reason, when I crop a PDF using preview the rest of the PDF is still “their” when opened using other software.
    I truly want to crop a PDF and have the uncropped portions completely go away.  Do I really have to open Photoshop to do this?

    "there" not "their"  -  unless I am really confused about what you are doing !
    I put a white rectangle over what I wanted to crop out of the pdf I was working on.
    Not a  proper solution, i then needed to use "export as PDF" of my PDF so that the next user of the document couldn't simply lift off the rectangle I had put on the document to cover what ideally I would have removed.
    Add mark up is something else I tried, to black out the text that I wanted concealed, but we are limited to a slim choice of colours, not including black.
    I would like to see a function "crop" with "crop inside" and "crop outside" options. I am not familiar with Adobe or other software. Presumably since they invented it, Adobe is the place to go if you have repeated exercises requiring meddling with Adobe documents.

  • How do I crop without aperture re-enlarging the photo? Can I maintain size of crop without drastically affecting size of mega pixel output for online data transfer to print site?

    HOW DO I CROP WITHOUT APERTURE RE-SIZING THE PHOTO? CAN I MAINTAIN THE SELECTED CROP SIZE (VERY SLIGHT EDGE TRIM) WITHOUT
    DRASTICALLY AFFECTING THE MEGAPIXEL SIZE BEING SENT TO ONLINE PRINTING SITE?

    Note the "Size" read out on the crop popup this tells you the size your cropped image wil be. eg. The image here is a 21 megapixel image, cropping the image like so reduces the file size to 5MP, your exported file size can only be a max of this 5MP.
    Hope this Helps, (HTH)
    Tony

  • How do I crop an image to 3.5 x 5

    I'm trying to match the size and aspect ratio of an older photo.  The old photo was printed at 3.5" x 5.0".
    How do I crop an image with Aperture to 3.5x5.0?
    Thanks.

    When you crop, the only control is the aspect ratio. You can crop an image with a custom ratio by selecting "custom" at the bottom of the aspect ratio popup menu in the Crop HUD that appears while in the Crop command.
    The size only matters when you print the image. In the print dialog you can set the size in inches of the printed image. The dpi of the printed photo will depend on the pixel size of the image divided by the printed size in inches.
    If you want to control the exact dpi of the printed image, you'll need a pixel editor such as Photoshop.

  • How to (visually) crop a screen recording???

    OK, QuickTime X is great at making a screen recording, and I now have a 1680x1050 .MOV. Great.
    What I want is to crop it, so that the video depicts for example 600x600 pixels in one are of the screen. How do I crop the resulting screen recording to achieve this? Tools readily available include QuickTime 7 PRO, iMovie 06 and Final Cut Express 4. With FCE I achieved a 1680x1050 recording where the 600x600 video played inside a huge black border. No good.

    Adobe Reader cannot edit PDFs in any way.

  • Can anyone tell me how to convert crop marks to registration on a supplied pdf. The pdf also has spot colours which the crop marks need to be in too.

    Can anyone tell me how to convert crop marks to registration on a supplied pdf. The pdf also has spot colours which the crop marks need to be in too.

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • How to Pan/Crop a Video?

    Alright, I'm a complete newbie when it comes to AE and I can't figure out how to pan/crop videos like in Sony Vegas. I need both my video and text to  be in a different position, but amazingly I couldn't find any results online. I am running CS6 , thanks for any help I can get.

    Getting started with After Effects
    Really, read it. If you can't even do a basic crop, then you'll forever run into trouble with the simplest things.
    Mylenium

  • How do you crop in Quicktime?

    I'm aware of the masking function, using a black and white gif, but I'm wondering if there is a way to actually permanently crop the movie, removing the information from the file to result in a smaller file size. Does anyone know if this is possible? I have been unable how to figure out how to do it with either Quicktime Pro or Autodesk Cleaner.
    Thanks!!!

    You have to re-compress the video. If you don't, the mask image must always stick to the video file. In such case, the file size won't change.
    Message was edited by: Horror in Oklahoma

  • How do i crop "out" a piece of image=ex: how it will look when its cut for a window. Crop a white space in image?

    How do i crop "out" a piece of image=ex: how it will look when its cut for a window. Crop a white space in image?

    I think this will help if you are using version 11 or 12.
    Make a selection with a selection tool of the area you want to remove.
    Example: rectangular marquee tool - make a rectangle.
    Use Select>Refine Edge:
    Use the View section of this dialog box to see a few views.
    If you need to refine the edge of the selection (smooth, feather, shift, etc.) you can do that in this dialog box.
    You may want to check the box about remembering your settings in case you need to come back to them.
    In the Output section, you can pick New Layer with Layer Mask and click OK.
    You should see the hole in your image.
    Kathy Keith
    @kathleenmadeline on Instagram
    (I teach Photoshop Elements classes)

  • How does one crop an .ai image to a defined shape?

    How does one crop an .ai image to a defined shape?
    In other words, I want to select and crop from a larger image an area such as a rectangle that I define.
    Right now, I try to select and crop a rectangular portion of an image but every shape that is even partially within the rectangle is selected both within and without the rectangle.
    I am using CS2 on a Mac.

    Clifford,
    I've figured out part 1, how to crop an image using a rectangle on  another layer.
    Then I did:
    To really get rid of the outlying parts, with the Clipping Mask still 
    selected you may:
    5) Choose anything but Normal in the Transparency palette dropdown 
    and Object>Flatten Transparency (just keep the defaults).
    The result was "Filter cannot complete because of unknown error"  FSpt
    Is this a bug, or is their a problem with the way I am following your 
    method?
    It is hard to say.
    It is more convenient to place the rectangle mentioned in 1) on the same layer; if you place the path(s) to define the Clipping Mask, the Clipping Mask and its contents will be on that layer, everything from lower layers being moved to it.
    What about 2) - 4)?
    It is easier to answer if you state what happens in the individual steps (repeated here):
    1) Create a rectangle on top of the image with the same size (you may use the Transform palette/panel to see the size, and to place it by);
    2) Create the cutout shape;
    3) Select 1) and 2) and Object>Compound Path>Make;
    4) Also select the image, and Object>Clipping Mask>Make.
    To really get rid of the outlying parts, with the Clipping Mask still selected you may:
    5) Choose anything but Normal in the Transparency palette dropdown and Object>Flatten Transparency (just keep the defaults).

Maybe you are looking for

  • How can i convert java application of bibeans to java applet?

    Hi Bibeans PMTeam, Bibeans provide two type client:java application and web client(JSP/Servlet),because web client's function is weaker than java app,so we want to convert java app to java applet,thus,we can embed java applet into web browser(our sys

  • Sending PO as PDF to multiple recipients

    Hi, I have to out put the PO as pdf and send it to mulitple recipients. I am taking the standard program and copied to z program and i did some modifications in it. i am able to send the PDF as attachment in a mail and its working fine. Now requireme

  • Question on SRM bapi

    Hi friends 1. In FM BBP_Partner_send(Partner id, Id of backend system) what is the signifinance of the parameters Partner id, Id of  backend system 2. Can we send bapis via Xi Regards Ashwini

  • About bdc call transaction and session method

    hi, can i know whether we could proceed with the bdc techniques without even copying and pasting in our program the perform statements from the recording process that we do for the particular transaction in TC SHDB. if we can pls send me a code for e

  • Joins in DW Dataset

    Is there a way to do Joins in your DataSet using the DataSet Wizard? I know I could just paste the Sql into the Sql box. But can you do it using the tables it displayes and picking the fields you want. All I can see is defining one table and choosing