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


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.

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


Creating the Objects    

We will need a canvas so we create it here.

Set canvas = Server.CreateObject("ImageGlue7.Canvas")


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.

canvas.DrawFile inpath, "rotate=90 pin=0,0"



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

canvas.SaveAs outpath , "Quality=medium"


Input and Output    

Sample input and output images are shown below.