From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Exports an object of type Picture.



Part Type Description
result Boolean True if the picture was saved successfully; False if the picture was not saved.
pic Picture A picture.


When ExportPicture is called, it displays a save-file dialog box so the user can save the picture in any directory. The user can also use the dialog box to choose a picture format. When the user chooses a format, the appropriate extension is automatically added to the filename.

ExportPicture returns True if the picture was saved; if the user clicks cancel, ExportPicture returns False.


The BMP format is supported on Windows.


The jpeg and png formats are supported on macOS.


The BMP format is supported on Linux.


The following code allows the user to save a picture. The jpeg file type has already been defined as a File Type using either the FileType class or the File Types Sets Editor in the IDE. It is referred to by the name of the object.

Var p As Picture
Var r As Boolean
Var f As FolderItem
f = FolderItem.ShowOpenFileDialog(FileTypes1.Jpeg)
If f <> Nil Then
p = Picture.Open(f)
r = ExportPicture(p)
If r Then
MessageBox("Your picture was saved.")
MessageBox("Your picture was not saved.")
End If
End If

See Also

Picture, FolderItem classes.