How can I automatically create a rectangular layer mask from an irregularly shaped selection?

I am trying to automatically crop images. The subject is on a white background and extends from the left edge of the image to the right. The top and bottom of the subject are within the frame. I need to crop a certain distance from the top and bottom of the subject and a predefined width that would be calculated from the height of the subject.
My current idea is to create a duplicate layer and run Threshold on it, which allows me to select the subject clearly. Once I have the subject selected I can use Image -> Crop to create the desired rectangle, but I can't figure out a way to create a mask from the irregularly selected subject. Does anyone know a way to take a selection and convert it to a rectangle? I hope this makes sense, I can try to explain better if not. Thanks.
--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) {}

Similar Messages

  • How can I automatically create calendar events using text from a Pages document?

    Hello,
    I'm looking for a way that I can automatically have calendar events created, by extracting dates and times from a table within a Pages document I have saved on my Mac.
    Currently, I record my working hours/dates on a Pages document in table format, so that I can record and ensure I receive payment for all hours I work.
    After finding out which shifts I have for the week, I insert the day, date, start time and end time (for each shift), into a table within a Pages document.
    I'm wondering if there is any way - such as through Automator, Apple Scripts, etc. - that I can then have the Calendar app automatically create events from that data - including the date, start and end times for each shift?
    Also, if possible, is there a way to set each event to automatically alert me at a chosen time (1 day, 2 days, etc.) beforehand?
    Here is an example of the layout of my document table:
    Date
    Start
    Finish
    Duration
    Saturday, 21 December 2013
    8:00 AM
    5:00 PM
    9:00 hrs
    Sunday, 22 December 2013
    9:00 AM
    6:00 PM
    9:00 hrs
    Monday, 23 December 2013
    12:00 PM
    9:00 PM
    9:00 hrs
    Tuesday, 24 December 2013
    12:00 PM
    6:00 PM
    6:00 hrs
    If anyone can help with this question, that would be greatly appreaciated, as then I could have my calendar automatically create and sync my work shifts across to my iPhone, iPad and Mac.
    Thanks in advance,
    John.

    I totally agree with you.
    Where are the fixes for a long string of bugs, glitches and user issues?
    Looking at the list of new "features" for the next OSX, Maverick (what a dumb name!), all I am seeing is Apple ripping off other peoples' ideas, something it swinges others mercilessly for.
    There is not one thing in Maverick that I don't already have, only more so, with 3rd party add-ons.
    Apple seems bereft of ideas now and I am totally mystified what it is doing with all that money and employees it has accumulated.
    Peter

  • How can I automatically create the files with serie-name?

    Hello, Everyone,
    I have a question again.
    How can I automatically create the file with a serie-filename?
    e.g. I have a program, it will repeat 5 times, and every time it will create a bmp-file, and I want to let this program automatically save these 5 files with a Serie-filename like File001.bmp, File002.bmp, .... File005.bmp.
    How can I do it?`
    Thanks a lot.
    Regarts,
    Johnny

    Hi Deepu,
    one more comment
    The format code should be "%04d" to get leading zeros and have filenames with same length...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How can I automatically fill and save PDF forms from an iSeries database file withouth viewing PDFs?

    We have incoming data that we need to insert into a PDF form then save an individual PDF file for each record from the database table for our Image system.  Data is coming from an iSeries file and I can Manually perform all the steps within the process, but this needs to be something that we can run from a scheduled job and should be a totally hands off process.  The form is in Adobe Acrobat and I've been trying some of the JavaScript pieces, but can't seem to get everything to run automatically.  I'm new to PC programming and can use any suggestions on how to handle this process.

    You might want to post this to the Acrobat SDK forum here. For it to work with Acrobat, it cannot be a completely automated process, however, due to licensing (and technical) restrictions. There are a number of third-party APIs that might help. If you post again, include what format the data is in (FDF, XFDF, XML, XDP) and what programming languages you can work in.

  • How do you automatically create paragraph styles from a document?

    Hi,
    (posted in general indesign as well - advised to post over here)
    I know I've seen this somewhere but can't for the life of me find it...
    How can I automatically create paragraph and character styles in an InDesign CC document? I'm sure I saw a script to do this and though I'll download that later...only i can't find it now.
    The scenario is that I have a document created by someone else which has lots of paragraph styles, but each one has over-rides on (so they're not really much use). I'm wanting something that will go through the document and create all the different styles that have been used.
    Any ideas?
    Thanks

    Hi
    I was given this tip to try: PerfectPrepText (http://indesignsecrets.com/perfectpreptext-a-smart-way-to-style-local-formatting.php) but couldn't get it to do what i was after unfortunately...however it did point me in the direction of something that does the trick:
    PowerStyles (DTP Tools - Power Styles for Adobe InDesign).
    Not sure if it's available for CC yet though.
    Thanks

  • How can i automate .pdf output and organize by color/bw?

    how can i "automate" multi-page .pdf output to preflight/imposition software workflow, organized by color/bw?
    basically what i'm trying to do is create a simple output function from InDesign that allows the user to just export a multi-page .pdf into a hot folder and on through preflight and imposition software. i want to be able to tell the hot folder which pages are color -so it can separate, rename and direct color pages to a color queue and b/w pages to a b/w queue.
    i've researched indesign distiller presets and the Acrobat JDF but the JDF isn't really meant for this exact purpose and doesn't help reduce the number of steps currently necessary to manually output/rename/etc.
    is there another way that i can embed information into a .pdf that could be read by a hot folder?

    You might check out this third-party plug-in for InDesign. It may or may not help you (I've never used it). I just saw it on the new Adobe Exchange (beta in Adobe Labs). Here's the description:
    Output Factory automates printing and exporting from Adobe InDesign. Export as single pages with variable file names, output layer versions, update modified links on the fly, preflight InDesign files before output, output to several format at once and much more.
    Just select the documents, adjust settings and Output Factory will do the rest for you. Keep working with other programs while Output Factory processes InDesign files in the background. Or leave it working overnight to output hundreds of documents, and the job will be done when you return in the morning.
    Key features:
    • Output multiple InDesign files automatically
    • Output as single pages
    • Automate printing and exporting to PDF, PostScript, EPS, Flash, IDML, EPUB and several image formats
    • Output files to multiple formats at once
    • Layer versioning: output layer combinations as single files
    • Update modified links automatically
    • Variable output file names
    • Preflight InDesign files and final PDFs
    • Supports books and booklet printing
    • Send output files over Internet and locally
    • Detailed output history
    System Requirements:
    - Adobe InDesign CS3-CS6
    - Mac OS X 10.5 and later, Intel-based Mac

  • How can I automatically close a dialog box using Javascript after I click the OK button to submit it?

    How can I automatically close a dialog box using Javascript after I click the OK button to submit it? I don't want to have to X out of the dialog box after I am done.
    Thanks
    Linda

    JS can not interact with open dialogs in any way, unless it's a dialog
    created in JS using the Dialog object.
    On Thu, Jul 24, 2014 at 11:13 PM, lindaeliseruble <[email protected]>

  • How are deliveries automatically created from scheduling agreement?

    How are deliveries automatically created from the schedule line of the scheduling agreement? Can anybody explain this step by step? Can we use the code VL10BATCH for this purpose? If we can, how is this code used?
    Thanks in advance.

    hi
    A customer scheduling agreement is an outline agreement with the customer containing delivery quantities and dates. These are then entered as schedule lines in a delivery schedule. You can either create schedule lines when you create the scheduling agreement or you can create them later.
    You fulfill a scheduling agreement by creating the deliveries in the schedule as they become due. You process deliveries for a scheduling agreement in exactly the same way as you process a normal delivery. After you have carried out the delivery, the system updates the Delivered quantity field in the scheduling agreement item with the delivery quantity.
    The scheduling agreement is used as a basis for delivering a material. The customer sends in scheduling agreement releases, referred to as delivery schedules, at regular intervals to release a quantity of the material.
    Document Types
    To configure document types for scheduling agreements, choose Sales -> Sales Documents -> Sales Document Header -> Define sales document types in Customizing for Sales and Distribution.
    The R/3 System contains the following document types for component suppliers:
    LZ - Scheduling agreement with delivery schedules (no external agents)
    LZM - Scheduling agreement with delivery orders
    LK - Scheduling agreement with delivery schedules (external agents)
    ED - Delivery by external agent (consignment issue)
    EDKO - External agent correction
    RZ - Scheduling agreement returns (no external agents)
    KAZU - Consignment pick-up for external agents
    KRZU - Consignment returns for external agents
    Item Categories
    To configure item categories for scheduling agreements, choose Sales -> Sales Documents -> Sales Document Item -> Define item categories in Customizing for Sales and Distribution.
    The system determines the following item categories for the related document types in
    documents containing materials with item category group NORM:
    Item category LZN for scheduling agreement type LZ
    Item category LZMA for scheduling agreement type LZM
    Item category LKN for scheduling agreement type LK
    Item category KEN for document type ED
    Item category EDK for positive corrections (or the manual alternative EDK1 for
    negative corrections) for document type EDKO
    Item category REN for document type RZ
    Item category KAN for document type KAZU
    Item category KRN for document type KRZU
    Schedule Line Categories
    To configure schedule line categories for scheduling agreements, choose Sales -> Sales Documents -> Schedule lines -> Define or Assign schedule line categories in Customizing for Sales and Distribution.
    The R/3 System contains the following schedule line categories for component suppliers:
    L1, BN, L2, and CN for item category LZN
    E4, E0, E5, and BN for item category LKN
    L2 for item category LZMA (standard for delivery order processing)
    Schedule Line Types
    To configure schedule line types for scheduling agreements, choose Sales -> Sales Documents -> Scheduling Agreements with Delivery Schedules -> Define schedule line types in Customizing for Sales and Distribution.
    Creating Scheduling Agreements
    To create a scheduling agreement with delivery schedules:
    1. In the Sales menu http://Ext. choose Scheduling agreement ->Create.
    2. Enter scheduling agreement type LK (standard) or LZ (external agents) and the
    relevantorganizational data.
    3. Choose ENTER.
    4. Enter the following data:
    Sold-to or ship-to party number
    Purchase order or closing number
    Material or customer material number
    You can use the Description field to identify the scheduling agreement. For
    example,
    you could enter the model year for a particular production series.
    The system allows up to 35 digits for a customer material number.
    Rounding quantity
    Usage
    Choose Goto -> Header -> Sales to enter the usage at header level, or Goto ->
    Item-> Sales A to enter it at item level. The system proposes usage S, for series, as default in both cases.
    Planning indicator
    Choose Goto -> Header ->Sales.
    Target quantity
    Mark an item and choose Goto -> Item -> Sales A
    Partners
    For scheduling agreements with external agents , choose Goto -> Header
    ->Partners to enter the external agent as forwarding agent and special stock partner
    on the partner function screen.
    5. Create a delivery schedule
    Mark an item in the scheduling agreement and choose Goto -> Item -> <Delivery
    schedule>. Enter:
    A delivery schedule number and date
    The cumulative quantity received by the customer
    The last delivery confirmed by the customer
    A schedule line with date, time, and quantity
    To enter additional data in the delivery schedule, choose DlvSch.Hdr (delivery schedule header).
    configuration:
    img->SD->Sales->sales document->scheduling agreements with delivery schedules->
    step1: define schedule line types
    schedule line types are not schedule line categories. Schedule line types are used for information purpose only.
    stds are 1. fixed date 2. backlog 3. immediate requirement
    4. estimate
    step2: maintain planning delivery sched. instruct/splitting rules
    The planning delivery schedule is an internal delivery schedule used to plan requirement s more efficiently.  It is sub divided into 3 parts
    2.1 delivery schedule splitting rules
    2.2 dly schedule instrusctions
    2.3 assign dly schedule splitting rules
    step3: define sales documents type
    step4 : define item categories
    step5: define schedule line categories
    step6: maintain copy control
    PROCESS
    step1:  create scheduling agreement
    VA31
    enter SP,SH valid from, valid to,
    goto ITEM OVERVIEW tab
    enter material, rouding qty
    select ITEM  click on FORECAST DLSCH
    enter different dly dates and qties
    save it.
    step2: create sales order with reference to above
    step3: create delivery
    step4: create billing
    regards
    krishna

  • How can I automatically prepend comment blocks to stored procedures?

    How can I automatically prepend comment blocks to stored procedures?
    In my organization, the standard is to comment all stored procedures with a comment block that looks like this:
    /*-- =============================================
    -- Created by: <Owner>
    -- Created date: 01/08/2012
    -- Purpose: Inserts new setting value, code and description
    -- Modifications:
    -- Modified by: <Owner>
    -- Modification date: 01/08/2012
    -- Purpose: Inserts new setting value, code and description
    -- =============================================*/Thanks.
    select * from v$version;
    BANNER                                                                        
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production             
    PL/SQL Release 11.2.0.2.0 - Production                                          
    CORE     11.2.0.2.0     Production  Edited by: xDeviates on 01-ago-2012 7:37
    Edited by: xDeviates on 01-ago-2012 8:31

    Hi,
    If I want to write a package called pk_fubar, I copy the following script and call it fubar.sql
    --     ==========  package_name.sql starts here  ==========
    --     Package_Name.sql
    SPOOL     &home_dir\package_name.lst
    PROMPT     .     H   H  EEEE     A    DDDD
    PROMPT     .     H   H  E       A A   D   D
    PROMPT     .     HHHHH  EEE    A   A  D   D
    PROMPT     .     H   H  E      AAAAA  D   D
    PROMPT     .     H   H  EEEEE  A   A  DDDD
    @@package_name_head
    PROMPT     .     BBBB    OOO   DDDD   Y   Y
    PROMPT     .     B   B  O   O  D   D   Y Y
    PROMPT     .     BBBB   O   O  D   D    Y
    PROMPT     .     B   B  O   O  D   D    Y
    PROMPT     .     BBBB    OOO   DDDD     Y
    @@package_name_body
    SPOOL     OFF
    @@package_name_test
    -- EXIT
    --     ==========  package_name_head.sql starts here  ==========
    CREATE OR REPLACE PACKAGE     pk_package_name
    AS
    FUNCTION     sign_in
    (     in_user_name     IN     VARCHAR2
    ,     in_password_txt     IN     VARCHAR2
    RETURN     PLS_INTEGER
    END     pk_package_name;
    SHOW ERRORS;
    GRANT     EXECUTE     ON pk_package_name     TO schema_name_some_role;
    --     ==========  package_name_body.sql starts here  ==========
    CREATE OR REPLACE PACKAGE BODY     pk_package_name
    AS
    --  Procedures related to SCHEMA_NAME ...
    --  2012 July 23 -- Package started with proc_x.  (Frank Kulash)
    --     **   local procedures and variables   **
    --     **   x   **
    --     **   initialization section   **
    --     The following code is executed once per session, when the package is loaded.
    BEGIN
         set_var     ( 'DT_FMT_TXT'
              , 'YYYY-MM-DD HH24:MI:SS'
    END     pk_package_name;
    SHOW ERRORS;
    --     ==========  package_name_test.sql starts here  ==========
    --     PACKAGE_NAME_TEST.SQL -- Test procedures in schema_name.pk_package_name
    SET     DOCUMENT     OFF
    SET     SERVEROUTPUT     ON     SIZE     10000
    ALTER SESSION     SET NLS_DATE_FORMAT = 'DD-Mon-YYYY HH24:MI:SS';
    SPOOL     @@package_name_test.lst
    PROMPT
    PROMPT     ***********************
    PROMPT     **  Testing x  **
    PROMPT     ***********************
    PROMPT
    SPOOL     OFFThen I replace package_name with fubar, and schema_name with the actual schema name. Finally, I cut off parts from the end to create fubar_test.sql, fubar_body.sql and fubar_head.sql. You could easily include a multi-line procedure comment template in this script. Every time you add a procedure or function, ciopy and paste that comment template, and then modify the copy.

  • How can i automatically delete doubel pictures from Iphoto?

    how can i automatically delete "double pictures" from Iphoto?

    There are several article that talk about this, here is one:
    http://macs.about.com/od/appleconsumersoftware/ss/Iphoto-Libraries-Create-And-Po pulate-Additional-Iphoto-Libraries_5.htm

  • How can you automate the monthly opening of MM periods

    How can you automate the monthly opening of MM periods ????????????

    RMMMPERI accepts a period/year or a date.
    If you enter a date the period is derived by it.
    1. create a variant and check the attribute 'selection variable' for the parameter date. Then click the button 'Selection variables' and set the current date. Every time this variant is used the parameter DATE is filled with the current date.
    2. create a job for RMMMPERI with the variant created in the preceding step. Set it as periodic.
    If you're not using a fiscal year variant simply schedule it as monthly (to be executed the first day of the month).
    If you are using a fiscal year variant you'd have to define a calendar with only the first day of each period defined as working 
    day and use it in the periodicity restrictions.
    Another possibility:
    Write a very simple ABAP which run daily to check if the period has changed and submit RMMMPERI.
    Regards
    Chander

  • Iphone4 would not restore Error -50. I have tried to restore and it restored it to the point that it created after 5.0 was installed. How can I get it an older restore point from my backups and restore it on another computer? The phone has been wiped out.

    Iphone would not restore---- Error -50. I have tried to restore, and it restored it to the new point that it created after 5.0 was installed. How can I get it an older restore point from my backups and restore it on another computer? The phone has been wiped out. I can see earlier backups in my C:\Documents and Settings\user\Application Data\Apple Computer\MobileSync\Backup folder. There are four subfolders in this address. I need my contacts, photos, and messages back. I know this is a common error but I can not figure it out. I have ran the other troublshoot items in the error steps for 13 and 14 like apple says. Is there a way to call apple and get a step by step of how to restore from another restore point? Does anybody have a solution????

    It tells you to go to Error 13 and 14 if you receive error (-50).
    Here is what I have tried...
    Error 13 and 14: These errors are typically resolved by performing one or more of the steps listed below:
    Perform USB isolation troubleshooting, including trying a different USB port directly on the computer. See the advanced steps below for USB troubleshooting. I have moved it around to different ports.
    Put a USB 2.0 hub between the device and the computer. Didn't change anything.
    Try a different USB 30-pin dock-connector cable.
    Eliminate third-party security software conflicts. Removed all virus protection and firewall.
    There may be third-party software installed that modifies your default packet size in Windows by inserting one or more TcpWindowSize entries into your registry. Your default packet size being set incorrectly can cause this error. Contact the manufacturer of the software that installed the packet-size modification for assistance. Or, follow this article by Microsoft: How to reset Internet Protocol (TCP/IP) to reset the packet size back to the default for Windows.Used the Microsoft fix it.
    Connect your computer directly to your Internet source, bypassing any routers, hubs, or switches. You may need to restart your computer and modem to get online. Doesn't matter.
    Try to restore from another known-good computer and network. I do not know how to do this or how to find the correct/full/complete restore point. There should be more information for this.

  • How can I remove my very old Apple ID from my Iphone 4S as I have created other apple IDs.The old one is still staying on my mobile but that email doesn't exist anymore. I cant rest my mobile as this email address is staying my icloud setting.

    Q:-
    How can I remove my very old Apple ID from my Iphone 4S. The old ID is still staying on my mobile but that email doesn't exist anymore. I cant rest my mobile as everytime i tried it asks ID password which I don't remember.

    Hello mushysun,
    Thanks for using Apple Support Communities.
    If you did not sign out of your Apple ID on your iPhone before creating a new one, then you will need to sign back in with your previous Apple ID and then sign out.  If you do not remember your password and do not have access to the email account, then you can reset your password by using the security questions.
    If you forgot your Apple ID password - Apple Support
    Have a great weekend,
    Alex H.

  • How can i re-create the download file on my dock

    i accidently removed the download and document folders on my dock..those are the ones that were pre-made when i purchased the macbook air. how can i re-create them?

    See image below - left side - gray area - click on documents folder then drag it down to your dock.
    do the same with the downloads folder.
    good luck

  • I bought iPhone 4 for my wife, didn't create a separate apple ID account for her at that time. How can I now create a new one for her, sync her phone to the same PC that I sync my iPhone with without loosing all of her data, contacts, etc. Please help!

    I bought iPhone 4 for my wife, didn't create a separate apple ID account for her at that time. How can I now create a new one for her, sync her phone to the same PC that I sync my iPhone with without loosing all of her data, contacts, etc. Please help!

    I bought iPhone 4 for my wife, didn't create a separate apple ID account for her at that time. How can I now create a new one for her, sync her phone to the same PC that I sync my iPhone with without loosing all of her data, contacts, etc. Please help!

Maybe you are looking for

  • My IPhone is dead.  What do I do.

    My IPhone is suddenly dead.  What do I do?

  • Flash player update on Facebook

    I am using Flash Player on my laptop for (amongst other things) Facebook. When opening a game (Candy Crush Saga) it informs me to update Flash Player, but when following the hyperlink, adobe says I have to most recent version.  I tried activating Fla

  • Configurator Developer tool

    I want to know whether we do still have Client version of Oracle Configurator. In 11.5.10 and Release 12.0, I see only html based version of Oracle Configurator (the one accessed from Oracle Configurator Admin responsibility). Can anybody please conf

  • ISight and Microphone

    Can you simultaneously record audio and video with the isight camera and the built in microphone on a Macbook Pro?

  • Adobe premiere pro cc doesnt open

    Hello! I ve got one problem. My file does not open. I noticed in Preview Files that at one time started to create Copy of files. None of these copies doesnt open. Original file can be opened, but i lost 5 hours of work. If anybody know what could be