tn8  
                
                  
                    January 11, 2022,  2:58pm
                   
                  1 
               
             
            
              hi,
I want to make a kind of slideshow which displays Jpeg images. I’m thinking to use Image class.  I wrote like this, but it produced instances of Images, I just want to make one image and replace the jpg files.Is there any method to replace the path of Image? or Should I use a different Class?
~imageList = [SCDoc.helpSourceDir +/+ "images/Swamp.png",SCDoc.helpSourceDir +/+ "images/Swamp.png"];
 (
t = Task({
    50.do({ arg i;
			~img = Image.new(~imageList[i% ~imageList.size]);
			~img.plot;
        2.wait;
    });
});
);
t.start(AppClock);
 
            
              
           
          
            
            
              from the help for Pen.drawImage (with a tweak)
( //this first
    w = Window.new.front;
    w.view.background = Color.red;
    i = Image.open(SCDoc.helpSourceDir +/+ "images/Swamp.png");
    j = Image.open(SCDoc.helpSourceDir +/+ "images/SC_icon.png");
    w.drawFunc_({
        Pen.drawImage( Point(140, 140), j, operation: 'sourceOver', opacity:1);
    });
)
( // then this
    w.drawFunc_({
        Pen.drawImage( Point(140, 140), i, operation: 'sourceOver', opacity:1);
    });
    w.refresh;
) 
            
              1 Like 
            
           
          
            
              
                tn8  
              
                  
                    January 11, 2022,  5:58pm
                   
                  3 
               
             
            
              Dear semiquaver, Thank you, I made it!
( //this first
~imagePath = [SCDoc.helpSourceDir +/+ "images/Swamp.png",SCDoc.helpSourceDir +/+ "images/SC_icon.png"];
~images = List[];
~imagePath.size.do{arg i ;
	i.postln;
	~images.add(Image.open(~imagePath[i]))
	};
    w = Window.new.front;
    w.view.background = Color.red;
    w.drawFunc_({
	Pen.drawImage( Point(140, 140), ~images[0], operation: 'sourceOver', opacity:1);
    });
)
 ( // then this ... change image every 1 sec
t = Task({
    50.do({ arg i;
			
		w.drawFunc_({
			Pen.drawImage( Point(140, 140), ~images[i%2], operation: 'sourceOver', opacity:1);
			});
		
		w.refresh;
        1.wait;
    });
});
);
t.start(AppClock);