Content Aware Fill

Quick experimentation attempting to use Photoshop’s Content Aware Fill feature on a video (actually images sequence).

TUTORIAL

USAGE

1. Open a video in After Effects and export it to a sequence of images
2. Using AE’s Tracker, track a point through the sequence
3. Select the track point, and execute the script posted below
4. Open Photoshop CS5 or CS6, and run the script ‘psBatchContentAwareFill.jsx’ created in step 3

Free material license

These scripts are copyrighted by Motion Boutique.
They are free for personal and commercial use but come โ€œas isโ€ with no warranty nor any free personal support.
Redistribution in any form is not allowed, instead always link to www.motionboutique.com for correct files.
By downloading any of these scripts, you agree the above terms.

DOWNLOAD

Icon

CreateParticularLights

Download

MORE TOOL

39 thoughts on “Content Aware Fill”

  1. This works really well. Is there a way to custom input a selection size or area with the PS script that you generate?

    Also, this only works with the traditional AE tracker, correct?

  2. not working for me: keeps filling in an area that is not even close to my track point. what do you think I’m doing wrong?

  3. This is bloody amazing! Thanks so much!
    (For others, note that the script created in #3 is saved in your AE scripts folder, I didn’t realize this immediately)

  4. Very cool. Note that it currently doesn’t support .PSD files. This is easily fixed by adding that case around line 110 or so (i.e. || files[i].name.toLowerCase().indexOf(“.psd”) != -1

  5. Oh, and to save to PSD, replace saveImageFile with something like the following:

    function saveImageFile(file)

    {

    var idsave = charIDToTypeID( “save” );

    var desc9 = new ActionDescriptor();

    var idAs = charIDToTypeID( “As ” );

    var desc10 = new ActionDescriptor();

    var idmaximizeCompatibility = stringIDToTypeID( “maximizeCompatibility” );

    desc10.putBoolean( idmaximizeCompatibility, true );

    var idPhtthree = charIDToTypeID( “Pht3” );

    desc9.putObject( idAs, idPhtthree, desc10 );

    var idIn = charIDToTypeID( “In ” );

    desc9.putPath( idIn, file );

    executeAction( idsave, desc9, DialogModes.NO );

    }

  6. Thanks. That script would solve a problem i have. I just can’t figure out what to do when I get in Photoshop. Do I have to load the sequence and then apply the script, or just execute the script? (either way nothing happens when I try). What’s the sequence of action when I’m in Photoshop? Thanks again. Great job.

    1. that comment from Klim may help : (For others, note that the script created in #3 is saved in your AE scripts folder, I didn’t realize this immediately)

  7. I haven’t tried this script yet, but I’m curious how to define the area for the content aware fill. Is this defined by the larger search area box or the smaller tracking box shape in AE’s tracker?

    1. Now that I think about it, the area I asked about is probably defined by the area selected while in Photoshop and the AE tracking is just to keep things tracked. Silly me…

  8. I’m doing something wrong. If someone could make a more detailed step by step, or even a tutorial, that would be awesome!

    When I’m running the script in After Effects I’m supposed to select this right:

    http://imgur.com/0DKP5Ls

    Do I have to put the script in the same folder as the image sequence?

    When I run the script in Photoshop, nothing happens. Is it supposed to run the batch automatically?

    Thanks!

  9. I’ve made it to Step 4.
    It gives me the error message, “could not content aware fill, requires selection”
    error occurs on line 79

    My guess is this happens because my tracking point starts off screen.

    (just modified my tracking point to stay on screen and it works)

    1. am running the photoshop script now but shouldn’t i choose the fill area first or is it after the script is done.

      1. The fill area is based on your After Effects trackers region of interest; I haven’t figured out how to make custom selections other than modifying that and running the AE script again.

        1. thanks my clip was 45mins long. have just stopped it to redo the track points in ae and only export out 5mins see how the content aware fill works

  10. I get an error that says…

    Error 21: undefined is not an object

    Line: 132
    -> var comp = app.project.activeItem;

    Any ideas as to what is wrong???

    1. I guess I couldn’t see the file name correctly on the PS File Browse point. Didn’t see batch in name. It’s doing something now. ๐Ÿ™‚

      1. I see that the CONTENT AWARE is not following what needs fixing. Do I need to make keyframes for the track box for it to know what to follow??????

        1. Okay so I keyframed the spot I wanted to be repaired. When I go frame by frame I see it track with the selected spot. However in Photoshop it is not tracking. Any ideas?

  11. Photoshop CS6 (64-bit) doesn’t seem to run the script. When I load it the load window just closes and leaves me with Photoshop with nothing loaded. Any ideas?

  12. Is there a way to export multiple points so you don’t have to fix, export, and repeat the process?

  13. I keep getting “JavaScript code was missing” when opening the script is PS CC.
    Any idea about what I’ve got wrong.

      1. Where can we download the photoshop part of the script “psBatchContentAwareFill.jsx”? – doesn’t appear to be packaged with the AE script for exporting.

  14. TO EVERYONE GETTING IN PHOTOSHOP *****Code JavaScript missing********** (Code JavaScript manquant)

    When you reach that part of the instructions that tell you to save an image sequence of what you’re gonna track and remove :

    =====> Make sure you click on the little down arrow next to the name of the file to be rendered (highlighted in blue) in the “destination” section of the render queue, which will bring up a floating menu.
    =====> Then, just click on first option, namely “name of the comp” (or whatever it is called in english), which will rename the sequence you are exporting to the actual comp name (maybe avoid any “!” “?”, etc., [in short any symbol windows does not like in a file/folder name] in your comp name in the first place, just in case).
    =====> Now click on that sequence to be rendered (the blue thingy) and choose the rendering location (it is advised to create a new folder in which to save those JPEG files so you don’t find yourself with possibly a hundred of them scattered everywhere :))
    =====> Once this done, simply hit the render button and follow the remaining instructions of the video (without forgetting to point to that folder when the script asks you to choose the folder containing your sequence of images).

    It is all a matter of folder names (well, for me it was, and now problem is solved). And it WORKS in After Effects 2017 (currectly using it). Anyway, just follow EXACTLY what the person in this tuto is doing and you won’t have any problem (in the video you can see that that little arrow is clicked onto, just like described above.

Comments are closed.