making thumbnails images from a source ImageMagick

I am trying to write a routine that will read an image, make a thumbnail and write the thumbnail as a new image file.
I am working with ImageMagick MBS . i have the MBS manual but it is really not so straight forward as to how to use the classes, and there are limited examples in the manual, there are no examples of writing images. Does anyone have an example or a link to an example of a simular routine that i could study.
the code that i have worked out is not complete … it stops at the image scaling .
I need to know how I may write the new thumbnail ( to a different file )
Does anyone have an example or a link to an example of a similar routine that i could study.

[code]dim image as IMImageQ16MBS
dim im as ImageMagickQ16MBS
dim imageinfo as IMImageInfoQ16MBS
dim s,blob as string
//dim p as Picture
dim i as Integer

dim newImage As imimageq32mbs

if f = nil then
Return “”
end if

imageinfo = im.NewImageInfo

If TargetWindows Then
imageinfo.Filename = f.AbsolutePath
else
imageinfo.FileName = f.ShellPath
end if

image = im.ReadImage(imageinfo)
//check for error
if im.lastexception <> nil and im.LastException.Severity >= 400 then
s = “Error: " + Format(im.LastError,”-0") + " - Severity: " + str(im.LastException.Severity) + EndOfLine + str(im.LastError) // str(Exception.Reason)
MsgBox s
Return “”
elseif image = Nil Then
MsgBox “image=nil”
Return “”
end if

// make thumb
newImage = image.scale(60, 60)
[/code]

Your image is data. Data is written to the harddisk with a binarystream. So the first thing to do is to check how to access the data of imimageq32mbs. Then it’s relatively straightforward to get a binarystream for writing.

imimageq32mbs.CopyPicture returns a Xojo Picture

you may be able to do it all in one pass like this (f is a folderitem where you have already set the path)

newImage.copypicture.Save(f, Picture.SaveAsJPEG)

or you may need to put the newImage.copypicture into a Xojo picture , then save it as a second step

thank you Beatrix
Thank you Jeff,

That gets me on the track thank you both.

one thing that perplexes me.
the scaling or resizing of the image is done by this class IMImageQ16MBS

The saving of the image is done by this class. imimageq32mbs

how can i go from one class to another
ex:
image.scale(60, 60) this does the scaling using IMimageQ16MBS

newImage.CopyPicture.Save(f, Picture.SaveAsJPEG) this class does the saving IMImageQ32MBS …