How can I create a new layer that is a gradient?

Hi, I'm very new to scripting photoshop and have some difficulty.

I am looking for a way to take a picture I have and configure it to have a gradient opacity as he approaches middle, my thought on how to do was simply to create a layer that is a gradient from the upper left to lower right and secure then as a vector mask.

Any ideas on how I could create this gradient layer of script or a better method to do this opacity gradient?

Thanks in advance,

Levianth

You can try this:

// 2012, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
var theLayer = myDocument.activeLayer;
if (theLayer.isBackgroundLayer == true) {theLayer.isBackgroundLayer = false};
// create gradient layer;
// =======================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc15 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref3 = new ActionReference();
        var idcontentLayer = stringIDToTypeID( "contentLayer" );
        ref3.putClass( idcontentLayer );
    desc15.putReference( idnull, ref3 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc16 = new ActionDescriptor();
        var idType = charIDToTypeID( "Type" );
            var desc17 = new ActionDescriptor();
            var idType = charIDToTypeID( "Type" );
            var idGrdT = charIDToTypeID( "GrdT" );
            var idLnr = charIDToTypeID( "Lnr " );
            desc17.putEnumerated( idType, idGrdT, idLnr );
            var idGrad = charIDToTypeID( "Grad" );
                var desc18 = new ActionDescriptor();
                var idNm = charIDToTypeID( "Nm  " );
                desc18.putString( idNm, "Custom" );
                var idGrdF = charIDToTypeID( "GrdF" );
                var idGrdF = charIDToTypeID( "GrdF" );
                var idCstS = charIDToTypeID( "CstS" );
                desc18.putEnumerated( idGrdF, idGrdF, idCstS );
                var idIntr = charIDToTypeID( "Intr" );
                desc18.putDouble( idIntr, 4096.000000 );
                var idClrs = charIDToTypeID( "Clrs" );
                    var list3 = new ActionList();
                        var desc19 = new ActionDescriptor();
                        var idClr = charIDToTypeID( "Clr " );
                            var desc20 = new ActionDescriptor();
                            var idRd = charIDToTypeID( "Rd  " );
                            desc20.putDouble( idRd, 0.000000 );
                            var idGrn = charIDToTypeID( "Grn " );
                            desc20.putDouble( idGrn, 0.000000 );
                            var idBl = charIDToTypeID( "Bl  " );
                            desc20.putDouble( idBl, 0.000000 );
                        var idRGBC = charIDToTypeID( "RGBC" );
                        desc19.putObject( idClr, idRGBC, desc20 );
                        var idType = charIDToTypeID( "Type" );
                        var idClry = charIDToTypeID( "Clry" );
                        var idUsrS = charIDToTypeID( "UsrS" );
                        desc19.putEnumerated( idType, idClry, idUsrS );
                        var idLctn = charIDToTypeID( "Lctn" );
                        desc19.putInteger( idLctn, 0 );
                        var idMdpn = charIDToTypeID( "Mdpn" );
                        desc19.putInteger( idMdpn, 50 );
                    var idClrt = charIDToTypeID( "Clrt" );
                    list3.putObject( idClrt, desc19 );
                        var desc21 = new ActionDescriptor();
                        var idClr = charIDToTypeID( "Clr " );
                            var desc22 = new ActionDescriptor();
                            var idRd = charIDToTypeID( "Rd  " );
                            desc22.putDouble( idRd, 0.000000 );
                            var idGrn = charIDToTypeID( "Grn " );
                            desc22.putDouble( idGrn, 0.000000 );
                            var idBl = charIDToTypeID( "Bl  " );
                            desc22.putDouble( idBl, 0.000000 );
                        var idRGBC = charIDToTypeID( "RGBC" );
                        desc21.putObject( idClr, idRGBC, desc22 );
                        var idType = charIDToTypeID( "Type" );
                        var idClry = charIDToTypeID( "Clry" );
                        var idUsrS = charIDToTypeID( "UsrS" );
                        desc21.putEnumerated( idType, idClry, idUsrS );
                        var idLctn = charIDToTypeID( "Lctn" );
                        desc21.putInteger( idLctn, 4096 );
                        var idMdpn = charIDToTypeID( "Mdpn" );
                        desc21.putInteger( idMdpn, 50 );
                    var idClrt = charIDToTypeID( "Clrt" );
                    list3.putObject( idClrt, desc21 );
                desc18.putList( idClrs, list3 );
                var idTrns = charIDToTypeID( "Trns" );
                    var list4 = new ActionList();
                        var desc23 = new ActionDescriptor();
                        var idOpct = charIDToTypeID( "Opct" );
                        var idPrc = charIDToTypeID( "#Prc" );
                        desc23.putUnitDouble( idOpct, idPrc, 0.000000 );
                        var idLctn = charIDToTypeID( "Lctn" );
                        desc23.putInteger( idLctn, 0 );
                        var idMdpn = charIDToTypeID( "Mdpn" );
                        desc23.putInteger( idMdpn, 50 );
                    var idTrnS = charIDToTypeID( "TrnS" );
                    list4.putObject( idTrnS, desc23 );
                        var desc24 = new ActionDescriptor();
                        var idOpct = charIDToTypeID( "Opct" );
                        var idPrc = charIDToTypeID( "#Prc" );
                        desc24.putUnitDouble( idOpct, idPrc, 100.000000 );
                        var idLctn = charIDToTypeID( "Lctn" );
                        desc24.putInteger( idLctn, 2048 );
                        var idMdpn = charIDToTypeID( "Mdpn" );
                        desc24.putInteger( idMdpn, 50 );
                    var idTrnS = charIDToTypeID( "TrnS" );
                    list4.putObject( idTrnS, desc24 );
                        var desc25 = new ActionDescriptor();
                        var idOpct = charIDToTypeID( "Opct" );
                        var idPrc = charIDToTypeID( "#Prc" );
                        desc25.putUnitDouble( idOpct, idPrc, 0.000000 );
                        var idLctn = charIDToTypeID( "Lctn" );
                        desc25.putInteger( idLctn, 4096 );
                        var idMdpn = charIDToTypeID( "Mdpn" );
                        desc25.putInteger( idMdpn, 50 );
                    var idTrnS = charIDToTypeID( "TrnS" );
                    list4.putObject( idTrnS, desc25 );
                desc18.putList( idTrns, list4 );
            var idGrdn = charIDToTypeID( "Grdn" );
            desc17.putObject( idGrad, idGrdn, desc18 );
        var idgradientLayer = stringIDToTypeID( "gradientLayer" );
        desc16.putObject( idType, idgradientLayer, desc17 );
    var idcontentLayer = stringIDToTypeID( "contentLayer" );
    desc15.putObject( idUsng, idcontentLayer, desc16 );
executeAction( idMk, desc15, DialogModes.NO );
// move layer below;
var theGradient = myDocument.activeLayer;
theGradient.move(theLayer, ElementPlacement.PLACEAFTER);
// clipping mask;
theLayer.grouped = true
};

Tags: Photoshop

Similar Questions

  • How can I create a new Style that can be applied to an object?

    To the active menu there is a tab called "Styles".  My question is how can I create a new Style that I can apply to an object?  A link to a tutorial or something like that would be helpful, because I can't find anything!    Thanks in advance for helping me eliminate this frustration!

    KomputerMan.com wrote:

    What I want to do is create a style library, which are basically photos of different Woods.

    There are two approaches you can try.

    Clipping paths

    1. draw the shape of the part as a closed path.

    2 position the wood grain image above or below the shape where you want it positioned.

    3. cut

    4. Select the closed path.

    5. glue on the inside.

    See: Using FreeHand MX > content > work with objects > working with clipping paths

    Fillings in mosaic

    1. use the autotrace to vectorize the image of wood fiber, using many colors.

    Using FreeHand MX > content > work of imported using the > Tracing bitmaps > image vectorization

    2. the group the paths (but not the picture) and create a tiled fill,

    Using FreeHand MX > content > using contours and funding > applying attributes in fillings > Using tiles fill attributes

    3 make a style of a filled object tile

    4. apply the style to other objects.

    Judy Arndt

  • How can I create a new document in Photoshop CC and have 300 dpi?

    How can I create a new document in Photoshop CC and have 300 dpi? I do digital scrapbooking and need to have my layout in Photoshop 12 x 12, so it's a scrapbook page and 300 dpi and I hope that sounds stupid, but I don't know even what dpi means.

    Thank you

    File > new

    Set preset to print and WE book

    (type the width and height values will change the custom preset)

    Setting width of 12 inches

    height of 12 inches

    the value 300 PPP (should already be present if you have used the print preset)

    Click OK

  • How can I create a new folder in Thunderbird

    How can I create a new folder in Thunderbird

    Right-click on the parent folder, a new folder option appears in the menu

  • What is the difference between a folder and a Briefcase. How can I create a new foler in a Briefcase?

    What is the difference between a folder and a Briefcase. How can I create a new foler in a Briefcase?

    This is just n his own when I wanted to create a new folder, right-click in an empty area and the icon associated with a Briefcase appeared. I'm not familiar with this notation or the form of file storage

    Thanks for the reply

    New folder is missing.
     
     
    How to remove and restore the default context Menu items 'New' in Windows 7 and Windows 8
    http://www.SevenForums.com/tutorials/28677-new-context-menu-remove-restore-default-menu-items.html
     
     

    Tip: When you save the text in Notepad, the default file format is .txt. Replace all files.
     
     
     

     
  • How can I create a new folder and add some choose another folder

    How can I create a new folder and add some pictures a different folder?

    Click Start-> computer.  Navigate to where you want to create the new folder.  Then, hold down the ALT key and press F.  Point again-> file and click folder.  Now, you have created the folder if you need to name it.  Type the name you want to give the file and press ENTER.  Now you have the new folder with the name you gave it.  Use him copy / paste to copy the images to the new folder.

    Good luck.

  • How can I create a new database without table using database configuration

    How can I create a new database without table using database configuration

    You can search for your "DBA 2 days" version oracle documentation for your version.  You should also read the manual of the concepts.  Create your own schema is pretty basic, all you have to do is to create a user.  Don't use dba or system for your own objects.

  • How can I create a pdf file that is read-only as a resume so that no one can change it

    How can I create a pdf file that is read-only as a resume so that no one can change it

    Hi carolanns81914351,

    You require the Acrobat application for this, see this KB document for the parameters to restrict modification of a PDF Acrobat help. Securing PDF files with passwords.

    Let me know if you have any additional questions.

    Kind regards

    Nicos

  • I want to install adobe Flash player, I don't know my password. How can I create a new or retrieve the original?

    I want to install adobe Flash player, I don't know my password. How can I create a new or retrieve the original?

    When you (or someone) first put on your computer, you (or someone) had to choose a password. This protects your computer, and you need to install most software or change the system. We cannot help you if you forget it, sorry.

  • How can I create a composite layer and which you use e control alt shift or Shift control alt e and when I do the pop deletion tool?

    How can I create a composite layer with 11 elements? How what should I do?

    How can I get an answer to my problem? I would never buy the program if I'm having this famous problem with getting help?

  • How can I create a new instance on unix

    Hello
    How can I create a new instance (instance only) on UNIX and how do I mount my database with this new instance.

    udayjampani wrote:
    Hello
    How can I create a new instance (instance only) on UNIX and how do I mount my database with this new instance.

    (1) define the Instance in your own way!
    If you simply create a startup nomount with her, and then - in theory - and pfile file you have a conduct of the proceeding (this method is used for example for restoring a backup rman)

    (2) you can't. The database files are related to a certain instance. What you can do is to recreate an instance with a different name for example, by using the scripts generated by an "alter database backup controlfile to trace;" command

    See you soon
    FJFranken

  • How can I create a new all-white or all-black layer without changing the current foreground color or background?

    I need to create a filled layer of black or white.  I need to do WITHOUT changing the current foreground or background colors. So I can't use the bucket tool. The reason is that I have created these layers inside Action and the need the current colors remain unchanged.

    Here's the easiest way I found to date:

    1. Layer-> new fill layer-> solid color...  Select one of the choices other than 'None '.  In the color picker dialog box, place the code hex #fff and click OK
    2. Layer-> rasterize-> content fill
    3. Layer-> Layer Mask-> remove

    Can someone suggest a simpler method?

    You can simply create a new empty layer and then go to Edit > fill and choose either black or white

  • How can I create a new gradient based on the current fill color that I am applying it?

    I often need to add gradients to shapes that already exist and already have a fill color. I want to add a gradient that would be a mixture of the color that is already there and the black.  Gradients of new totally ignore what existed before. Is it possible to include the fill color that is already there in the slope?

    In fact, you can skip the step of swatch. You can drag the fill color directly from the toolbar at the appropriate end of the fitting band gradient in the gradient/panel palette; Then, apply the gradient. Be careful, though - you can end up creating a new unwanted color along the gradient stop.

  • How can I create a new presentation of shop e-commerce in British Colombia? The default layout is inadmissible and who do not steal! :)

    Hello to everyone.

    I've been building and development using BC for awhile but avoids the functions of e-commerce like the plague, because of all my knowledge and trial a mistake, I couldn't adjust available outside the columns of the table how much I can add. I'm looking to create some sensitive stores but feel completely constrained by the store layout because it can't be adjusted. Yes I tried the same and adjustment module style sheet styles declare my rules with "!" important"with no luck. I then asked the team to BC online chat. If it was still possible, and they said 'no' dish. Then I saw 'light at the end of a tunnel' If you want by browsing a few Business Catalyst models (I honestly can't bring myself to use models that I like a lot of this building and landscaping my own pages). With this model here, the cameras and accessories you can see the shop features sensitive so I know it's possible (Damn you BCGurus and your mad skills). I also found some amazing layouts by Enough of Pollution , which has also made a few sensitive shop like this Web sitelayouts.

    Overall, how can I achieve this? How can I create a fully customized store page layout and virtually any custom also available? I have the feeling that I needed to learn the programming language for this liquid, but seriously, the indications at this point would be greatly appreciated! If I learn liquid programming, I'd love to learn where there might be some amazing courses / tutorials / documentation. I have the feeling, it comes down to create my own model of liquid layout and rerouting of the off-set modules in the new model... I'm on the right track?

    Sorry, so many questions. Let me tackle that I really want to know haha!



    • How can I create a layout of the sensitive shop in British Colombia?
    • What would be the necessary steps?
    • If I need to build models of liquids, where can I learn all this? (I know that the BC user guide has much butI will not lie, it's a little overwhelming)

    Thank you all so much for your time in reading this and I greatly look forward to learn more about Business Catalyst. Honestly, I'd love to try and use this platform for all of my clients.

    Hello

    Support will be have not said you that it was not possible, they would have told that it is outside the scope of their support. Is this possible? Of course, it's, it's the foundations of basic BC, HTML and CSS more then anything else.

    Honestly, it has nothing to do with incredible skill, amazing code or anything else.

    First of all, BC is just tags and you should use reference material:
    The developer reference

    Here you see the overall plan and tags. If you look at the list of product tags you see that you can set in a list schema (no tables).

    From there allows you to encode your small layout, large presentation cart layout, provision of registration (payment) because you need to and code the CSS to adapt.

    -You can float elements so float the li of the store

    -The basics of the CSS to make the elements of fluid width of code etc.

    -Questions from the media CSS code to make sensitive matters

    All pretty much toast front-end html, css, nothing special here development stuff. You have classes on the points for each element of a line in British Colombia according to the parameters that you set on the tags and so on.

    If you want to take the next step you enable liquid markup in the characteristics of BC and take things further.

  • I recently purchased Photoshop elements 12 and the system is to say that the Redemption Code is no longer active.  How can I get a new code that allows access to the software?

    I recently purchased Photoshop elements 12 and the system tells me that the Redemption Code is no longer active.

    How can I get a new Code number that will allow met to access the software?

    you need your serial number.  you used your number of redemption to redeem your serial number.

    If you don't know your serial number, check the account used to purchase or register your PES 12, Adobe ID

Maybe you are looking for

  • Qosimo X 70-A-12N-absence start upward since the update of the BIOS?

    Hello I guess that since the BIOS was updated yesterday, after pressing the Start button of the laptop,It stops after 4 seconds with a black screen. so far, perhaps randomly, when I push any key of the keyboard, start with windows 8.1 normally. Qosim

  • Pavillion 500-054

    I am trying to install an Azus HD 6670 graphics card in a pavilion of 500-054.  I changed the power supply so it has enough juice.  When I put the card in the machine it sounds right and I get nothing.  The CMOS Setup program is without help it seems

  • Not recognized by the computer

    I had a clip and used well before he died.  I now have the video for my husband, but my computer does not recognize it.  I did countless repetitions of all fixes offered on the site, nothing helps.  I listen to podcasts, not music.  Help!

  • Volume under license of Windows 7 Enterprise Edition new install hangs at disk.sys

    Original title: installation of new Windows 7 hangs at disk.sys We have conducted our mail, ftp and video servers on XP because we expected a software upgrade for our video server, so that we can install Windows 7. The MB is a Gigabyte GA-H55M-UD2H R

  • Links will not open or read online .wmv files

    IE8 will not play video files WMV links With IE8, under Windows7 RC, in a Web page there is a link such as: http://.../file.wmvIf I click on it, an error page appears immediately, saying: Internet explorer cannot display this webpage.A more detailed