If you have to do it more than one.. write a script.

Hello everyone,

In the past, I’ve tried and tried to learn the fundamentals of python.
“They” say python is an easy language to learn. Not as far as I’m concerned though.

I think that perhaps in this one instance I may come to grips with how it works if I had a little help with my current problem. I’m going to assume there is no exact way a script will work. From my reading, most advice is " you could try something like this…"

My problem: I have a number of image strips in sequence. They all have the wrong path.
I have to add additional information to the beginning of the path.
Would someone kindly give me an example or two of what this script might look like?
I’d like to learn how to do these things myself. And hopefully later help others.
Thanks to all.,


do jou need something like this?

imlst = ['im1.jpg','img2.jpg']
prefix = "c:\\user\\ikke\\imgages\\"
newlist = [prefix + imlst[i] for i in range(len(imlst))]
['c:\\user\\ikke\\imgages\\im1.jpg', 'c:\\user\\ikke\\imgages\\img2.jpg']

imgages = images :smiley:

Sometimes it is easier to make assumptions about data that you are going to operate on with a script. Like, for instance. All my images are going to reside in the same folder. PKHG’s solution will certainly work, but what happens when you are finished with your scene and archive time comes around? I have found that it is better to simply gather up your footage/stills into a working folder for any given project. That way if you need to transfer the scene to another computer for rendering, for instance, you have all the assets in one place.

Here is some code I used to load images.

def returnImageTexture (passedFileName):
    tempTexture = Texture.New()
        tempImage = Image.Load(passedFileName)
        tempTexture.animFrames = 3140
        tempTexture.image = tempImage
        print ("Loaded image texture [" + passedFileName + "].")
        tempImage = None
        print ("Unable to load image texture [" + passedFileName + "].")
    return tempImage, tempTexture
#Code Execution begins here.
localScene = Scene.GetCurrent()
# This default material will be applied to all other sides of the cube (ie not video face)
matDefault = Blender.Material.New('cubeDefault')
matDefault.rgbCol = 1,0,0

imagePath = 'C:\\Documents and Settings\Developer\\My Documents\\Blender\\scenes\	extures\\'
#Load the images we are going to use.
matImage1 = Blender.Material.New('cubeImage1')
matImage1.rgbCol = 0,0,1
fileName1 = imagePath + 'image-1.jpg'
myImage1, myTex1 = returnImageTexture(fileName1)
matImage1.setTexture(0, myTex1,Texture.TexCo.UV,Texture.MapTo.COL)    #Texture Channel, The Texture,Map Input, Map To

matImage2 = Blender.Material.New('cubeImage2')
matImage2.rgbCol = 0,1,0
fileName2 = imagePath + 'image-2.jpg'
myImage2, myTex2 = returnImageTexture(fileName2)
matImage2.setTexture(0, myTex2,Texture.TexCo.UV,Texture.MapTo.COL)    #Texture Channel, The Texture,Map Input, Map To

matImage3 = Blender.Material.New('cubeImage3')
matImage3.rgbCol = 1,1,0
fileName3 = imagePath + 'image-3.jpg'
myImage3, myTex3 = returnImageTexture(fileName3)
matImage3.setTexture(0, myTex3,Texture.TexCo.UV,Texture.MapTo.COL)    #Texture Channel, The Texture,Map Input, Map To

matImage4 = Blender.Material.New('cubeImage4')
matImage4.rgbCol = 0,0.5,0
fileName4 = imagePath + 'image-4.jpg'
myImage4, myTex4 = returnImageTexture(fileName4)
matImage4.setTexture(0, myTex4,Texture.TexCo.UV,Texture.MapTo.COL)    #Texture Channel, The Texture,Map Input, Map To

matImage5 = Blender.Material.New('cubeImage5')
matImage5.rgbCol = 0.5,0.5,0
fileName5 = imagePath + 'image-5.jpg'
myImage5, myTex5 = returnImageTexture(fileName5)
matImage5.setTexture(0, myTex5,Texture.TexCo.UV,Texture.MapTo.COL)    #Texture Channel, The Texture,Map Input, Map To

matImage6 = Blender.Material.New('cubeImage6')
matImage6.rgbCol = 0,0,0.5
fileName6 = imagePath + 'image-6.jpg'
myImage6, myTex6 = returnImageTexture(fileName6)
matImage6.setTexture(0, myTex6,Texture.TexCo.UV,Texture.MapTo.COL)    #Texture Channel, The Texture,Map Input, Map To

I shall examine both codes to see if I can make heads or tails out of.
Not sure if I will get python even still… But I won’t give up.
I think maybe I need to take a class.
Sorry for the late reply. Things have gotten a little crazy around here lately.

Best wishes,