Apply the Image with layer.id or layer.itemIndex

Hello

I want to use the 'Apply Image' function in my JavaScript.
Because this function is not available in API, I recorded with the 'ScriptListener.8li' function calls
Here is the code that was generated (I reformatted the code a bit to make it more readable):

function testIt() {
    var ref24 = new ActionReference();

    var idChnl = charIDToTypeID( "Chnl" );
    var idChnl = charIDToTypeID( "Chnl" );
    var idRGB = charIDToTypeID( "RGB " );
    ref24.putEnumerated( idChnl, idChnl, idRGB );

    var idLyr = charIDToTypeID( "Lyr " );
    ref24.putName( idLyr, "My Layer Name" );
        
    var desc30 = new ActionDescriptor();
    var idT = charIDToTypeID( "T   " );
    desc30.putReference( idT, ref24 );

    var idClcl = charIDToTypeID( "Clcl" );
    var idClcn = charIDToTypeID( "Clcn" );
    var idSbtr = charIDToTypeID( "Sbtr" );
    desc30.putEnumerated( idClcl, idClcn, idSbtr );

    var idScl = charIDToTypeID( "Scl " );
    desc30.putDouble( idScl, 2.000000 );

    var idOfst = charIDToTypeID( "Ofst" );
    desc30.putInteger( idOfst, 128 );

    var desc29 = new ActionDescriptor();
    var idWith = charIDToTypeID( "With" );
    var idClcl = charIDToTypeID( "Clcl" );
    desc29.putObject( idWith, idClcl, desc30 );

    var idAppI = charIDToTypeID( "AppI" );
    executeAction( idAppI, desc29, DialogModes.NO );
}

The problem: the function is based on the name of the layer.
This can cause problems if two layers have the same name:

ref24.putName( idLyr, "My Layer Name" );

How can I get this to work of function with 'layer.id' or 'layer.itemIndex '?
I tried for over six hours and have not found a solution.
Help, please!

Something on the lines of.

function apply(ID) {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('RGB ') );
ref.putIdentifier(charIDToTypeID('Lyr '), ID); //Layer ID
//ref.putIndex( charIDToTypeID('Lyr '), idx ); //Layer Index
var desc = new ActionDescriptor();
desc.putReference( charIDToTypeID('T   '), ref );
desc.putEnumerated( charIDToTypeID('Clcl'), charIDToTypeID('Clcn'), charIDToTypeID('Sbtr') );
desc.putDouble( charIDToTypeID('Scl '), 2.000000 );
desc.putInteger( charIDToTypeID('Ofst'), 128 );
var desc2 = new ActionDescriptor();
desc2.putObject( charIDToTypeID('With'), charIDToTypeID('Clcl'), desc );
try{
executeAction( charIDToTypeID('AppI'), desc2, DialogModes.NO );
}catch(e){}
};

Tags: Photoshop

Similar Questions

  • What is the best way to edit the pixels of the layer without applying the image?

    Help, please!?

    What is the best way to change the pixels on a new layer (clone, healing, patch or selection) without applying the image? When I do that, I can't change the under layer if I make a mistake.

    Does this make any sense!

    You want to use the patch tool to put the fix on its own layer? Use sample all layers in the Options bar.

  • can anyone provide a link to insert the image with the text on the button in the apex 4.2.6

    can anyone provide a link to insert the image with the text on the button in the apex 4.2.6

    ReemaPuri wrote:

    in the workspace image:-resign.jpeg

    As a button? Seriously?

    Ok. First of all, because the image already contains text, there no point in including the same wording in the form of text on the button. Accessibility requirements can be met using re-sign as alternative text. 4.2, create an image button:

    Tag/Alt text: Re-sign

    Static ID: re - sign

    Style button: Image

    Button Image: & WORKSPACE_IMAGES.resign.jpeg

    To make the image looks more like a button, add the following CSS to Inline CSS property page:

    #re-sign img {
      margin: 0 2px 2px 0;
      border: 2px outset;
      border-radius: 4px;
    }
    #re-sign img:active {
      margin: 2px 0 0 2px;
      border: 2px inset;
      border-radius: 4px;
    }
    

    Finally, there is a bug in 4.2 that generates the incorrect URL for the button images, which requires dynamic action of Page Load to fix.

    Event: Loading the page

    Action: Run the JavaScript Code

    Code

    var resignImg = $("#re-sign img");
    resignImg.attr("src", resignImg.attr("src").replace("/i/", ""));
    
  • How to improve the resolution of the image with the help of filters

    How to improve the resolution of the image with the help of filters?

    resolution of the image, please check the links below. They should give you a clear idea about the resizing and resampling of images.

    http://helpx.Adobe.com/Photoshop/KB/Advanced-cropping-resizing-resampling-Photoshop.html#m ain_Resizing_and_resampling_images

    Understanding vs Resample resize | Learn Photoshop CS6 | Adobe TV

    See you soon!

    ~ David

  • How to do an image have several clickable camp arrives with a box next to the image with a text. as I click on a bone in an image a box comes up next to the image with which are the OS.

    How to do an image have several clickable camp arrives with a box next to the image with a text. as I click on a bone in an image a box comes up next to the image with which are the OS. I have cs6

    This article has very clear steps & description of what you're trying to accomplish:

    http://Demosthenes.info/blog/537/enhancing-Imagemaps-with-CSS3-popups#wheelset

  • How to create an item of the display of the Image with functions Apex?

    Hi everyone :)

    I'm working on the 4.1.1.00.23 Apex in an 11g database XE.

    I want to display an Image in a report, I can do this by using the ' + BLOB download Format mask + ", but the images displayed in the original format and I want to display the smaller.

    I read that you need to create a procedure, a SYNONYM and call them to the src of the img tag. as Zsuzsi Vadasz mentions here
    http://blog.hilandco.com/2010/05/How-to-show-BLOB-type-column-as-image.html

    But I remember that I was able to create items in reports with the functions of the Apex, I think they were APEX_ITEM package, so I want to know if there is a way to create the '+' display Image + element with a function of APEX.

    Thank you.

    Diego (SniperCat) wrote:

    I'm working on the 4.1.1.00.23 Apex in an 11g database XE.

    I want to display an Image in a report

    Always specify if "report" means the report standard or interactive.

    I can do this by using the ' + BLOB download Format mask + ", but the images displayed in the original format and I want to display the smaller.

    I read that you need to create a procedure, a SYNONYM and call them to the src of the img tag. as Zsuzsi Vadasz mentions here
    http://blog.hilandco.com/2010/05/How-to-show-BLOB-type-column-as-image.html

    This post was obsolete when it was written. Use the built-in support of BLOB.

    Resizing of the declarative BLOB images in reports is simple using CSS. Add a style sheet with:

    td[headers="PHOTO"] img {
      display: block;
      width: 40px;
      border: 1px solid #999;
      padding: 4px;
      background: #f6f6f6;
    }
    

    where the value of the PHOTO in the attribute selector is the ID of the image column table header. Define only a single dimension (in this case the width) will scale the image with the correct proportions. (Background, padding and border properties are just eye candy...)

    However, the scaling of the images in the browser in this way is a huge waste of bandwidth and product of lower quality images than to create good scaled down versions using image tools. Image download megapixel and then to reduce them to the size of the thumbnail result in needlessly pushing millions of bytes which will never be seen.

    For better performance and image quality, and where you need specific image scaling of the best approach is to use the ORDImage database object to produce thumbnail and preview automatically versions. Unfortunately, this is not possible in Oracle XE as multimedia is not included :-(.

  • Apply the Image to the datagrid row

    Hello

    I have a problem I need to apply the image to the selected line in the datagrid control dynamically, we have
    "selectedcolor" but I need to apply the image to the selected line is it sort it please help me
    customer needs to this effect

    Karthik.k

    your postal code, please, let me look if I can help

  • AECC BUG? Photoshop groups is no longer the import with layer styles?

    Hello.

    I noticed something small.  But important to me.

    Import from a psd into After Effects works beautifully.  But in previous versions, when you import a psd model group resulting retains the layer styles.  This happens is no longer for me in CC.

    Everyone there this problem?

    Is this by design?

    Is this a bug?

    He will be back?

    Thanks for looking,

    -Josh

    After Effects has never read the layer on a group styles in a PSD file. Application of layer groups styles is a new feature in Photoshop CS6. After Effects CS6 and CC are not last updated to read the layer styles applied to groups.

    IOW, we just never wrote the code to make it work. I suspect that you were using a different method (for example, workaround below) to provide for several layers of Photoshop layer styles in After Effects.

    You can work around this limitation by transforming your group in a smart object layer. Right-click on the group in the layers panel, and then choose Convert to smart object. You will now see the styles of layer on the associated layers in AE, but styles will be editable and PSD layers will be merged unfolded, not a nested model.

    Please submit a feature request for all the features (like reading the layer on the groups styles, or editable on the smart objects layer styles, or to import dynamic objects as nested compositions) that you would like to have added to After Effects:

    http://www.Adobe.com/go/wish

  • fade in the text with layer styles

    I try to have the letters in a Word to fade slowly upward. I have the layer text, added a few styles of layer (stroke, bevel, shadow) and then to apply the preset animation / text / animate in / fade up by letter.  However, which fades to the top are the styles first for each letter. The first appearance of each letter is the color of the outline, and then other styles are added slowly until the end of each letter.  I want each completed letter to fade slowly upward. I couldn't find any setting of host who could achieve.  Any ideas?

    I think the only thing that is causing problems is the race. Try adding the race using the palette of characters instead of the layer styles. Now, if you simply add a host of opacity for the text layer, set the opacity to 0 and animate the range selector you should have what you want.

  • Duplication of the images with multiply does not quite...

    Help.jpg

    Okay, so I'm puzzled.

    I just gave and got on the train CC after years of use of CS5. I decided to try this whole thing of CC community instead of just googling so this is:

    I want to create a transparent image (see image above) and the best option that I see so far is multiply, but it leaves a darker area where the images overlap. I tried to use the wand, but you know how sticky, it seems later. There MUST be a quick and simple way to do this kind of stuff so here I ask the Lords for their expertise.

    Thanks in advance.

    Select all layers, then go to Edit > auto-merge layers

    Try with just the Normal blending mode on each layer.

  • Size and align the Image with Perspective Warp

    How do you get an image to the size and align it with the perspective distortion, unless I approach this wrong?

    You don't say how you approaching.  If something has a look of perspective.  He has a perspective not shape, size and resolution.   First of all, you need to resize the image to the size of the shape's aspect ratio. the boundaries of the shape. Hide the image resize to this form. Perspective transform the layer just perspective-looking mask.  And also to position the layer.

    To tell the truth do not know how to automate all this.  Automate everything resizes images for the limits of the perspective transform the final location of the image.  I align the image resize without perspective the limits of location and hide the image to the shape in the image of the perspective transformation.  I finished the automation here.  I leave the user with the responsibility to transform the layer to add the look of the perspective and rotation. I have no idea how to do to automate rotation and the appearance of perspective or create to a template that can be filled with automation of Photoshop.

  • Right-click on the image with link problem after upgrade to 11.0

    After the upgrade, whenever I do a right-click on an image with a link, it opens the link rather than opening a menu drop-down. Any idea on what is causing this behavior?

    OK, think about it. Extension: Tab Utilities was the origin of the problem. Uninstall completely solved the problem, disable it does not solve it.

  • Problem loading the images with the php script.

    As a webdebdesigner that I developed a cms system to download images with php to a mysql database. Firefox version 5.0.1 for MAC and earlier versions have no problem with the script download. But after this version, it is impossible to upload images more large then 250 KB. The page where the customer chooses his image for the download hangs and the form is not sent to the real upload script, which must validate and process the image.
    This problem only occurs in Firefox, all other browsers work fine!
    In addition to this: give feedback for firefox is not possible for the Mac.

    Try announcement Web development / standards evangelism MozillaZine forum. The helpers there are better informed on issues related to the development of website with Firefox.

    http://forums.mozillazine.org/viewforum.php?f=25

    You will need to register and log in to post in this forum.

  • Create the image with black and white patterns

    Hello

    With the attached VI I am able to create an image that is completely black (or white or any color according to values in the color palette). See picture1.

    Is it possible to create an image as photo 2 and photo 3 or any other form which consists of black and white patterns? I need an image with black and white areas that a camera can recognize.

    Thanks for any help.


  • Resize the image with HTML5 Canvas - distortion

    Hi all

    I'm working on a Webworks app where I need to resize an image to upload it to a server. I use JQuery Mobile, the application should run on OS6 and upward. The user can use the camera or select a picture, the power off. The corresponding code is the following:

    function handleOpenedFile(fullPath, blobData) {
                    var image = new Image();
                    image.src=fullPath; //path to image
                    image.onload = function () {
                        var resized = resizeMe(image); // send it to canvas
                        //Do stuff with the DataURL returned from resizeMe()
                    };
            }
    
    function resizeMe(img) {
    
                var canvas = document.createElement('canvas');
                var width = Math.round(img.width / 2);
                var height = Math.round(img.height / 2);
                canvas.width = width;
                canvas.height = height;
                var ctx = canvas.getContext("2d");
                ctx.drawImage(img, 0, 0, width, height);
                return canvas.toDataURL("image/jpeg", 0.8);
            }
    

    I then use the Base64 in the DataURL for download on the server. The images are reduced, but they are truncated. Parts of the image are shifted autour and colors come out strange. It is not scaling in itself than the mess to the top of the picture it comes out garbled if you draw on the canvas without any scaling.

    Does anyone have an idea how to solve this problem or have another suggestion to resize an image for download?

    I managed to solve the problem of resizing for anyone who takes place also in this. Replacement of

    return canvas.toDataURL("image/jpeg", 0.8);
    

    with

    return canvas.toDataURL();
    

    solved the problem with the strange visual artifacts. Returns a picture of resized without any strangeness.

Maybe you are looking for

  • El capitan installed can stop now not computer

    Hello I have a macbook mid 2012 pro and I installed os x el capitan.  When I start the computer and if I left without getting into any application, everything is fine.  Once I have go into any application and then of course exit the application and t

  • TouchPad on my Satellite A50 error

    I have a Satellite A50 (PSA50E) and recently I had a lot of problems due to a virus. I managed to solve it, but now when I start my computer a message still appears:"ED - FEL Det gick inte att hmta Toshibas snabbtangenter TOUCH.Felkod - 0 x 00031402,

  • USB charging

    Hello I just bought HP stream 7 Tablet.   IAM able to charge the Tablet via usb power cable but I am not able to load via cable sb via laptop. Could you please check and let me know if this is expected behaviour or problem?

  • Re: Outlook Express, I've lost the Outbox, sent and Delete

    first of all, I am very poor with computers, and I use Outlook Express for my e-mail.  I lost the sent, Outbox and delete.  I need people, and although I know not easy to put back them, how can I do?  I don't know even how I made them disappear!    

  • How can I change the lines using popup

    Hi allHow can I edit line on unalterable table to context-sensitive help? I'm doing a new column in the table called active.In this column: created a command link--> < af:showPopupBehavior popupId = "" / >I can't selectedrow, when I clicked on "Edit"