Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

In Blender how I can get an ImageSequence source filename in video editor (VSE)?

In Blender, when you use Video Editor (VSE), you can parse items using Python like this :

import bpy
import os

for seq in bpy.context.sequences:
  sFull_filename = ""
  if seq.type == "MOVIE":
    sFull_filename = seq.filepath
  if seq.type == "SOUND":
    sFull_filename = seq.sound.filepath
  if seq.type == "IMAGE":
    sFull_filename = "??"  # How to get it for images ?
    sName = seq.name       # /!\ It is not the file name !
    sPath = seq.directory
  # Finally
  sAbsolute_name = bpy.path.abspath( sFull_filename )

As you can see, I get the filename for movies and sound, but how can I get it for images ?

On Blender api documentation website I don’t found how to do it…

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I try to get VSE images strip file names…

>Solution :

You can get the names from elements list of seq:

    ...
    elif seq.type == "IMAGE":
        # Get the first image filename
        sFull_filename = os.path.join(seq.directory, seq.elements[0].filename)  

    sAbsolute_name = bpy.path.abspath(sFull_filename)
    print(sAbsolute_name)

or if you want them all, iterate over seq.elements

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading