Rotate vAngle, bCalculateOnly, vWidth, vHeight [,vOffsetX] [,vOffsetY]
Set g = CreateObject("shotgraph.image")
filename = "c:\i\harbor.jpg"
angle = 10
g.GetFileDimensions filename,width,height
newwidth = width
newheight = height
' Calculate requred dimensions for new image
g.Rotate angle,True,newwidth,newheight
' Create primary imagespace
g.CreateImage newwidth,newheight,256
g.InitClipboard width,height
g.SelectClipboard True
g.ReadImage filename,palette,0,0
' Rotate image in the secondary imagespace
' and write it into in the primary one
' a1 and a2 are dumb parameters here.
g.Rotate angle,False,a1,a2
g.SelectClipboard False
g.JpegImage 90,0,"c:\i\rotated.jpg"
Wscript.echo "Ok"
Const maxwidth = 150
Const maxheight = 150
Set g = CreateObject("shotgraph.image")
file = "c:\i\harbor.jpg"
newfile = "c:\i\i1578.rotated.jpg"
RotateFile file,10,newfile
Wscript.echo "Ok"
''''''''''''''''''''''
'' END
''''''''''''''''''''''
Sub RotateFile(filename,angle,newfilename)
Dim width,height,newwidth,newheight,rwidth,rheight
Dim a1,a2
Dim palette
g.GetFileDimensions filename,width,height
if width = 0 then Exit Sub
if width > maxwidth or height > maxheight then
' Image needs to be resized
if width/maxwidth > height / maxheight then
rwidth = maxwidth
rheight = height * maxwidth / width
else
rheight = maxheight
rwidth = width * maxheight / height
end if
' Read source image into primary imagespace
g.CreateImage width,height,256
g.ReadImage filename,palette,0,0
g.InitClipboard rwidth,rheight
' Resize image in primary imagespace to secondary imagespace
g.Stretch 0,0,rwidth,rheight,0,0,width,height,"SRCCOPY","HALFTONE"
width = rwidth
height = rheight
else
' Dumb primary imagespace
g.CreateImage 1,1,256
g.InitClipboard width,height
g.SelectClipboard True
' Read source image into secondary imagespace
g.ReadImage filename,palette,0,0
end if
' Now, the rotated image is located in the secondary imagespace
newwidth = width
newheight = height
' Calculate required image size (alter newwidth, newheight variables)
g.Rotate angle,True,newwidth,newheight
g.CreateImage newwidth,newheight,256
g.SelectClipboard True
' Read source image into secondary imagespace
g.Rotate angle,False,a1,a2
g.SelectClipboard False
g.JpegImage 90,0,newfilename
End Sub