This example shows how to draw an image from a file, rotated 90 degrees clockwise.

 

   
1
 
Setting Up    
     

We start by setting up variables we will use later - the path to the source file and the path to the output file.

[VBScript]
inpath = Server.MapPath("birds.jpg")
outpath = Server.MapPath("rotatedbirds.jpg")

 

   
2
 
Creating the Objects    
     

We will need a canvas so we create it here.

[VBScript]
Set canvas = Server.CreateObject("ImageGlue7.Canvas")

 

   
3
 
Drawing the Image    
     

Draw the image rotated 90 degrees. Because we rotate around the origin we will lose the image off the edge of our canvas unless we are careful. We could translate the image back onto the canvas but to do this we would need to know the size of the image. The easiest thing to do is to pin the top left of the bounds of the rotated image to the origin.

[VBScript]
canvas.DrawFile inpath, "rotate=90 pin=0,0"

 

   
4
 
Saving    
     

Finally we save the picture as a medium quality JPEG image.

[VBScript]
canvas.SaveAs outpath , "Quality=medium"

 

   
5
 
Input and Output    
     

Sample input and output images are shown below.

birds.jpg

rotatedbirds.jpg