Yeah it is possible to directly import an image into the After Effects Timeline using a script. Here is one example using the JavaScript API:
// Set the path to the image file
var imageFilePath = “my_picture.jpg”;
// Create a new After Effects comp
var comp = new Comp(“my_comp”);
// Define the size of the comp to match the dimensions of the image
var width = 1600;
var height = 1200;
var compSize = [width, height];
// Import the image using the File.importFile() method
var layer = comp.addLayer(“My Image Layer”);
var importResults = layer.file.importFile(imageFilePath);
// Add the layer to the topmost layer of the timeline
layer.move(comp.numLayers – 1);
// Set the duration of the comp to match the duration of the image
comp.duration = importResults.duration;
// Write the comp to disk
var filePath = “my_comp.aep”;
comp.saveAs(filePath);
This script above creates a new composition, imports the image file from a specific path, adds the imported layer to the topmost layer of the timeline and also sets the duration of the comp to match the duration of the image. Then it exports the comp into a new .aep file. Note that you’ll need to have the File.importFile() method installed in order for this script to work properly.
Hope that this helps and if you have any other questions, feel free to ask! 🙂