[SOLVED] Add Effect Strip Transform for Image VSE LM18

Hello Blender Friends, Im from Germany and my english is not so good but I hope your understand my and can help.

I will create a simple Slide show in VSE automatically but it don’t work. I try some Scripts but they don’t work.

The first what I do, I make it manuel and look in the Info for the code.

Until now I have one line that works.

import os
import bpy

bpy.context.scene.sequence_editor.active_strip.frame_final_duration = 26

The second lines I try in different forms but they give my errors like this.
I enter this in the Blender Console

>>> bpy.ops.sequencer.effect_strip_add(frame_start=0, frame_end=25, type='TRANSFORM')
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/home/tron/Downloads/blender-2.78c-linux-glibc219-x86_64/2.78/scripts/modules/bpy/ops.py", line 189, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.sequencer.effect_strip_add.poll() failed, context is incorrect

The code line from Blender Info if I make manuel add a Effect Strip.
I try this in different other forms like this.

>>> bpy.ops.sequencer.active_strip.effect_strip_add(frame_start=0, frame_end=25, type='TRANSFORM')
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
AttributeError: 'BPyOpsSubModOp' object has no attribute 'effect_strip_add'

Does anyone know how I do can Add Effect Strip Transform for active strip Image?

Greeting Tron


Distro: Linux Mint 18 Sarah
Kernel: 4.4.0-64-generic x86_64 (64 bit)
Desktop: Cinnamon 3.0.7

CPU: Quad core Intel Core2 Quad Q6600 (-MCP-) cache: 4096 KB
clock speeds: max: 2400 MHz 1: 1600 MHz 2: 1600 MHz 3: 1600 MHz 4: 2400 MHz

Graphics: Card: Advanced Micro Devices [AMD/ATI] Oland PRO [Radeon R7 240/340]
Display Server: X.Org 1.18.3 drivers: ati,radeon (unloaded: fbdev,vesa)
Resolution: [email protected], [email protected]
GLX Renderer: Gallium 0.4 on AMD OLAND (DRM 2.43.0, LLVM 3.8.0) GLX Version: 3.0 Mesa 11.2.0

The problem you encountered is that you can’t call VSE operators from within Console or Text window, it must be VSE window. That would be possible if you define a new VSE operator from your code and then call it – but I guess that would be too tricky for the simple thing you’re trying to do.

There are basically two ways of data access in blender python: Operators and direct data access. Unfortunately, the Sequencer data api is quite clumsy compared to Mesh or others, but still it can do anything that Operators would.

To access the VSE at all, do this:

seq = bpy.context.scene.sequence_editor_create()

Then, you can add a new Image strip (for example) like this:

slide = seq.sequences.new_image("slide", "~/tmp/00000008.IMG_2655.JPG", 0, 15)

You’ll have the slide saved in a variable, which allows you to easily access it (no matter if it’s selected or not):

slide.frame_final_end = slide.frame_start + 5

Read the API documentation if you need other types of video strips.

If you want to use an operator, you can. You just need to set the context. Here’s how I did it in my addon Bligify:

import bpy

def find_sequencer_area():
    screens = list(bpy.data.screens)
    for screen in screens:
        for area in screen.areas:
            if area.type == "SEQUENCE_EDITOR":
                return screen, area

scene = bpy.data.scenes['Scene']
sequence = scene.sequence_editor

mystrip = sequence.sequences_all['a_picture.jpg']
sequence.active_strip = mystrip

screen, area = find_sequencer_area()
window = bpy.context.window
location = {
    "window": window,
    "scene": scene,
    "area": area,
    "screen": screen,
    "region": area.regions[0]

bpy.ops.sequencer.effect_strip_add(location, type="TRANSFORM")

emu’s solution looks promising though.

Hello emu and doakey3, thank you for help.

Both solutions work.
But a name must always be specified in the script.

With this small script it work without specifying a name and I’ve tried to adjust your scripts accordingly

import bpy
bpy.context.scene.sequence_editor.active_strip.frame_final_duration = 100

Actually, I just wanted to mark the strip and press on Run Script.

Because there are several steps that must be executed. And only for one image strip. And there will be many more.

  1. 1 frame length get
  2. Add Transform
  3. from 16: 9 to 4: 3 or rotation and 3: 4
  4. Make Meta Strip
  5. get 100 frame length

If you ask yourself why step 1 is set to 1
And step 5 is set to 100
I have just made a video here which explains it better.
But this will make rendering faster with a slide show.

You don’t need to specify a name. Just collect the strips into a list based on criteria (is it’s type = ‘IMAGE’, or is it’s channel = 1 etc.) Then use a for loop to iterate over each one and add your transform effect and do whatever else you want to it.

all_strips = list(sorted(sequence.sequences, key=lambda x: x.frame_start))

image_strips = []
for strip in all_strips:
    if strip.type == 'IMAGE':

for image in image_strips:
    <here's where you add your transforms to each one>

You could use a similar method to go back and iterate over each transform strip to adjust it’s settings.

I’ve tried it so. But I get an error. Do you know what I can do? I know this is a bit much but I can not Python I can only a bit Bash.

import os
import bpy

all_strips = list(sorted(sequence.sequences, key=lambda x: x.frame_start))

image_strips = []
for strip in all_strips:
    if strip.type == 'IMAGE':

for image in image_strips:

I have come to the decision that it is too complicated with Blender to create a slideshow.
I now use the software “PhotoFilmStrip” to create a slideshow and then paste it into Blender.
Then put together video material and picture material.

Nevertheless, thanks for the great help.

@doakey3 looks like the last line: bpy.ops.sequencer.effect_strip_add(location, type=“TRANSFORM”)
may be old in 2.8 when I run the function it pops out a function with 3 variables:

bpy.ops.sequencer.effect_strip_add(frame_start=6, frame_end=31, type=‘SPEED’)

I’m guessing if your code works the function has multiple overloaded function calls defined based on the number of variables passed in by the function call, but how do I ensure the selected strip passes the variables by setting the context???


bpy.ops.sequencer.effect_strip_add(frame_start=frame_start, frame_end=frame_end,

I don’t know what context or what structure holds the member variables for the selected strip to ensure the function will execute passing the correct values for start and end frames. To satisfy the function call I sure can’t type in the location of every strip I want to apply the SPEED type modifier to.

The idea is a basic “execute script” shortcut to execute the script on the selected strip. Of coarse TRANSFORM is a different type than SPEED so I can see the function calls being different but I don’t see frame_start or frame_end defined anywhere in the location structure in your code, so what define’s them and is it a private data structure we have to pass by address to locally define from local member variables we create in our own script? :thinking:

Ich spreche deutsch sehr gut. Well maybe not so sehr gut :wink: