Replace rectangle with an image.

What would be an easy way to replace a rectangle (a solid or a form) with an image programmatically? I guess that the image has the same proportions as the original rectangle. Thank you!

Try this (where comp.layer (1) is a solid whose properties, editing or not, you want to apply to the image - I didn't test this with a shape layer):

var proj = app.project;
var comp;
for (var i = 1; i <= proj.numItems; i++){
  if (proj.item(i) instanceof CompItem){
  comp = proj.item(i);
  }
}
var shape1 = comp.layer(1);
var importOpts = new ImportOptions(new File("/yourDirectory/yourImage.png"));
var importImg = proj.importFile(importOpts);
shape1.replaceSource(importImg,false);

Tags: After Effects

Similar Questions

  • Create a rectangle with an image inside

    Hi all

    Issue of great starter... how to create a rectangle with an image inside.

    My project:

    -Create a dialog box where to put the name of the image.

    -create the link between the image to the active document (the photo is in the 'Links' folder)

    -make a rectangle in my document with an image inside.

    Think it all is ok except the last step (a start, I was spirit "which is the easier"... but no).

    Thank you very much and sorry for my English.

    to add a rectangle:

    var rect = doc.rectangles.add ();

    to place an image inside:

    Rect.place (file (image. Path));

  • Can I create a snapshot and replace it with an image (or link another picture than the current)?

    Based on http://forums.Adobe.com/thread/1308132?TSTART=0 I decided to add each question separately:

    Hello, I am very interested in buying Lightroom 5.2. I tried the RC that was missing today. Yet, I have several questions that I can't find really good conclusive answers, I'd like to get an answer before buying LR. Please do not write maybe like this or that (assumptions), because I don't want to start my entire workflow and then realize that I have to change all around, please reply, if you know for sure that something works and you are, preferably, using this method too.

    Can I create a snapshot and replace it with an image (or link another picture than the current photo)? Details: I made adjustments in iPhoto until now I want my (unpublished) masters, some RAWs JPEGs, create a snapshot and set the photo as the one to keep. If it is not possible, all of the recommendations (in addition the usual masters of backup and import changes).

    What I do is I have to assign some metadata down battery photo indicating of don't not to export the picture. Then, I use either a collection of smart to find the photo I want to and can not find the photos, I don't want and export all in the smart collection. or I use a Collection of post Smart, even once allows me to select only the pictures I want and not those I want.

    Of course you manually uncheck items you want to export, which work as well.

  • Need to replace &lt; Input_Agent_Path &gt; with real image

    Hi all

    I'm working on a POC that involves Webcenter Capture, Webcenter, Webcenter content Imaging pattern recognition. My documents become captured in Capture and rejected in the import folder WFR via parameter commit in the WC. Then my document is checked in JAR and place in the export directory. Is the creative suite 3 files

    1. .tiff file

    2 .xml file

    3 .txt file.

    This .txt file is my entry for Webcenter content of imagery. But when the file is created, it is created < Input_Agent_Path > 4725_CUST_DOC3.tif like this. I don't want to have < Input_Agent_Path > this and it should be with my real account of my way of entry officer. How and where we can configure the same?

    Thank you.

    Kind regards

    Deena

    Hi Deena,

    This configuration you will need to do in the OFR project ini file.

    to the bottom of the file, you will find

    CSV_VL_01_FormatLine1 =/.< %="" quelque="" chose="">

    Here, you will have to replace it with your entry paths site.

    hope it helps.

    see you soon,

    Patricia

  • Maybe need help a guru of the BC with catalog images

    Ran into a problem that I can't solve. In a Word...

    I downloaded a series of images to a Web site for use in the form of images of catalog. I did not check to see if they have the right size (and Yes, I've learned my lesson). Realizing the error, I have the group removed the larger images of their file via FTP and replace them with smaller images with the same name.

    On the next web page, I hope you see what I see.

    http://rocorescue01.2121customcontact.com/rescue-equipment/hardware

    All the images are the same proportions and dpi (90x90px at 72 dpi). The HTML and CSS are the same, and all are reading from catalog display Module.

    Yet, some of them seem to be reading from the larger images that I already deleted. There are others who did the same yesterday, but they seem to have corrected themselves. I left my browser, emptied the cache, but no luck. I use Firefox, but Google Chrome displays the same thing.

    My only thought is that perhaps the British Colombia uses a cache image which should have been deleted somehow? This is why I plead for an employee (or guru) thoughts.

    Here's a hat from small screen to illustrate my point.

    catalogimagesissue.jpg

    -Chuck

    Thanks for the heads up Chuck.

    This could be a problem with caching on the side BC.  I activated the option to clear the cache of varnish for the site so this should hopefully solve your problem.

    I would like to know if it is still problematic.

    See you soon!

    -Sidney

  • Why some images are displayed as small rectangles with numbers?

    When I visit some sites, some of the images make under small rectangles with letters and numbers on the inside. This issue seems to be with Firefox (see motogp.com_FireFox.jpg, attached), rather than the site because the site displays properly when I get another browser, such as SeaMonkey (see motogp.com_SeaMonkey.jpg,) attached.

    The website, motogp.com is one I visit frequently; It happens on this site. See 2 pictures attached for an example of this problem.

    The box identifies a character not in the police who are using Firefox. This happens usually when a site has changed use images for its icons to use characters in a custom font, you need to download. There are three common reasons for the glitch:

    (1) uncheck the box 'Allow pages to choose their own fonts' here:

    "3-bar" menu button (or tools) > Options > content > button "Advanced".

    If the pages are not allowed to specify their own fonts, Firefox uses the specified here, police who normally does not have the required pictures.

    (2) disabling fonts download. To check that:

    (A) in a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful.

    (B) in the search above the list box, type or paste gfx and make a pause so that the list is filtered

    (C) If gfx.downloadable_fonts.enabled preference is bold and user, set false, double-click it to restore the default value true

    (3) extension of block the download. NoScript has a feature to block the downloadable fonts, for example.

  • Is it possible that I can have a spindle of pinterest this button that only appears to fly into a rectangle with image fill?

    Is it possible that I can have a spindle of pinterest this button that only appears to fly into a rectangle with image fill? In any case for also not having to add each individual image, but all the photos on the page would have a?

    The code is not in the head section, but in the body section. Try to paste the code in the html body and test it again. Sick it works. I couldn't make it work for rectangle with image fill, but it works for images.

  • Please help, I want to replace a shape with an image. I don't understand what I'm doing wrong.

    I watched a video of a guy this step by step and I still can't make it work.

    What I want to do is to replace a shape with an image. I guess the way to do is to make the image of the background color of the form, if you want to. On the element of the scene, I click on "creationcomplete", and then type the following code:

    ($(sym.lookupselector("BIG_RIGHT_BOX")).css('background-image','url(images/Karma.jpg)');

    I put the photo (karma.jpg) in the project, and I can see it in the "images" tab

    You are very close - just a few things:

    1. No need to lookupselector - in Animate, use sym. $)
    2. The url itself should also be nested quotes

    Then try this:

    SYM.$("BIG_RIGHT_BOX"). CSS ('background-image', 'url("images/Karma.jpg")');

    That should do it...

    HTH,

    Joe

  • Replace the link display the basket with an image

    Hello

    I need help do the above.

    It worked but clicked the wrong button and restore to the original model.

    I searched through the 'help' and found this _image http://KB.worldsecuresystems.com/654/bc_654.html#main_Replacing_the_View_Cart_link_with_an but the link no longer works. It's in a post that Mario has implemented

    The solution involves no javascript code just a change to the tag?

    Hello

    In my view, there is an option in the tag, but I don't remember off the top of my head.  I'll check with our team for this info.

    In the meantime, the solution is to update your 'modulestylesheet.css' CSS and update the background with an image file attribute.

    Here is the result on the front-end server.

    I hope this helps!

    -Sidney

  • Icons for .docx files are rectangles with black lines on the inside

    I recently increased the size of the font on my computer for the icons (via the Customize option in the context menu in the office) one size higher (I think it's 10 now). I don't know if it's related, but now when I see the .docx files on my desktop and in folders in my documents instead of a rectangle with blue lines and a blue w, score in the corner, I see is a rectangle with a large number of black lines. It's not what I'm used to, and it's distracting. When I make the folders in my documents score show list view or small icons, I think the traditional icon. But when I do the plus icon (either medium or large size), I get this black rectangle. I don't know if Windows tries to give me a thumbnail of the file (or the first page of it) or not, but I'd rather widely by the icon traditional .docx.

    How can I get that back?

    I use Office 2010 on Windows 7.

    I agree, it sounds like it is trying to display a thumbnail.  To turn off power, click on organize up to left and go in options of records, then on the display, the first box tab, according to me, must "always show icons, not thumbnails.

    Unfortunately it also means that you will not see your thumbnails of photo either, just an endless sea of identical icons to 'image file '.

    You can also delete the thumbnail of the file itself.  Open the file in Word, choose "Save as" and uncheck the "save thumbnail" option until you press save (and confirm the replacement of the same file, save on top of itself with the non-thumbnail version).

  • Why can't I create a rectangle with width and height reagent?

    I created a rectangle with no fill. I gave it a shadow effect. But I can't not only resize with width "sensitive." Why can't resize it with 'width and height sensitive "? It seems that I should be able to do, but I can't (or maybe I'm missing something). Thank you, this should be a simple question to answer, or to present it as an improvement of the obvious feature in the next update.

    An image can be sensitive in width and height !

    So what you could do is to place an image, assign reactive width and height, then double-click it and delete the content, so you no longer have the frame empty to the left, but sensitive to the width and height :-)

  • How to change the Rectangles with buttons

    I'm working on this example that does not work correctly:

    public class test extends Application
    {
    
        private void init(Stage primaryStage)
        {
    
            Group root = new Group();
            primaryStage.setScene(new Scene(root));
    
            String pillButtonCss = DX57DC.class.getResource("PillButton.css").toExternalForm();
    
            // create 3 toggle buttons and a toogle group for them
            ToggleButton tb1 = new ToggleButton("Left Button");
            tb1.setId("pill-left");
            ToggleButton tb2 = new ToggleButton("Center Button");
            tb2.setId("pill-center");
            ToggleButton tb3 = new ToggleButton("Right Button");
            tb3.setId("pill-right");
    
            final ToggleGroup group = new ToggleGroup();
            tb1.setToggleGroup(group);
            tb2.setToggleGroup(group);
            tb3.setToggleGroup(group);
            // select the first button to start with
            group.selectToggle(tb1);
    
            //////////////////////////////////////////
    
            final VBox vbox = new VBox();
    
            final Rectangle rect1 = new Rectangle(300, 300);
            rect1.setFill(Color.ALICEBLUE);
            final Rectangle rect2 = new Rectangle(300, 300);
            rect2.setFill(Color.AQUA);
            final Rectangle rect3 = new Rectangle(300, 300);
            rect3.setFill(Color.AZURE);
    
            tb1.setUserData(rect1);
            tb2.setUserData(rect2);
            tb3.setUserData(rect3);
    
            group.selectedToggleProperty().addListener(new ChangeListener<Toggle>()
            {
                @Override
                public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle)
                {
                    if (new_toggle == null)
                    {
                        //rect.setFill(Color.WHITE);
                    }
                    else
                    {
                        vbox.getChildren().addAll((Node[]) group.getSelectedToggle().getUserData());
                        //rect.setFill((Color) group.getSelectedToggle().getUserData());
                    }
                }
            });
    
    
            ///////////////////////////////////////////
    
    
            HBox hBox = new HBox();
            hBox.getChildren().addAll(tb1, tb2, tb3);
            hBox.setPadding(new Insets(20, 20, 260, 20));
            hBox.getStylesheets().add(pillButtonCss);
    
    
    
            vbox.getChildren().add(hBox);
            //vbox.getChildren().add(rect);
    
            root.getChildren().add(vbox);
        }
    
        @Override
        public void start(Stage primaryStage) throws Exception
        {
            init(primaryStage);
            primaryStage.show();
        }
    
        public static void main(String[] args)
        {
            launch(args);
        }
    }
    
    
    

    I want to create several Rectangles (or in which object or object) in which I want to store data. I want to spend the Rectangles (objects) that appear in front of the user by using the buttons. The example that I put in place does not work correctly. Can you tell me what is the right way to implement this?

    REF javafx 2 - How to change the Rectangles with buttons - stack overflow

    You have two problems:

    User data that assign you to each button switches are a node, not a [Node]. Thus, the cast will fail on line 43.

    When the selected toggle changes, you add another Rectangle to the vbox. You want to replace the rectangle that is in the vbox.

    Try

    vbox.getChildren () .setAll ((Node) group.getSelectedToggle () .getUserData ());

  • Y at - it replacement tool path for "Image &gt; adjustments &gt; Variations...» "Photoshop cs6 more Standard?

    Y at - it replacement tool path for "Image > adjustments > Variations...» "Photoshop cs6 more Standard that brings similar results?  I was used to using Image > adjustments > variations of Photoshop CS4 Standard Standard more often. I've upgraded to Photoshop CS6 additions assayed for the compatibility of architecture memory 64-bit on my Macbook Pro, started in Mountain Lion.  I see now that Photoshop CS6 Addition Standard has the "Image > adjustments > Variations...» "removed toolpath.

    I do not have Photoshop CS6 extended, which has the new Image > adjustments > variations... toolpath.  I only have Photoshop CS6 addition so if someone can share with me a substitution toolset that can give me results similar to the use of the old "Image > adjustments > variants...," I'd appreciate it.

    As far as I know, Variations has been removed from the service standard/extended cs6 photoshop and photoshop cc on the side of mac

    (versions of windows still have the command variants)

    You can use the levels instead of variations.

  • Invert the mask of clipping with imported image

    I have a rectangle on an image larger and imported, and I would like to get rid of this area which covers the ractangle. Clipping mask does the opposite, getting rid of the outside area and pathfinder only works for traces, not imported images. I'm a little confused on this and I was wondering if anyone has any ideas on this.

    Thank you!

    Yes, you can get the best results with an opacity mask. Remove the box that you want to knock it out of your black color image, select the image and the black box and in the transparency Panel click make masks. Then uncheck the Clip. You should see the center of the image, knocking out where was the box, and you should have Clip and mask that reverse the two deselected.

  • Replace them with AE Comp

    I have a clip in PrPro I need to edit in After Effects.  While I did a right click and click on "replace footage with After Effects Composition" I edited my images and saved and replaces very well in PrPro.  Later (after the closing and restarting PrPro and AE), I decided that I wanted to tweek this clip even more... but when I click on 'replace with AE Comp', my images in AE is replaced by a color sample.  This change extends to PrPro and AE and only ctrl 'Z' will bring back my images.

    In addition, project Panel PrPro shows again that the edited original AE model that worked well the first time.  But I can't take it back to AE to edit it further.  It seems that I can only edit a piece of film once in AE before PrPro will not replace more correctly.  Any ideas what I am doing wrong?

    Thanks in advance,

    TEX

    Once you have replaced a clip in the sequence Pr Pro with composition AE and AE project saved, you need not use "replace with After Effects Composition" for the same clip again. Just open the saved AE project and edit the images. All changes will automatically appear in the sequence Pr Pro. You simply make a new render this piece of the sequence.

Maybe you are looking for