Picture.IsExportFormatSupported
From Xojo Documentation
Shared Method
Picture.IsExportFormatSupported(format as Formats) As Boolean
Supported for all project types and targets.
Supported for all project types and targets.
Introduced 2010r3
Returns True if the passed format is supported for export.
Example
This example checks to see that the format is supported for export prior to calling it:
Var imageData As String
Var bs As BinaryStream
Var f As FolderItem
If ImageWell1.Image <> Nil Then
// Get a temporary file to save the image to
If Picture.IsExportFormatSupported(Picture.Formats.JPEG) Then
f = SpecialFolder.Temporary.Child("TempImage.jpg")
// Save the image out to the file
ImageWell1.Image.Save(f, Picture.Formats.JPEG)
End If
// Open the file as a BinaryStream and read the data in
bs = BinaryStream.Open(f, False)
If bs <> Nil Then
imageData = bs.Read(bs.Length)
bs.Close
End If
// delete the temporary file if it exists
If f.Exists Then
f.Delete
End If
End If
Var bs As BinaryStream
Var f As FolderItem
If ImageWell1.Image <> Nil Then
// Get a temporary file to save the image to
If Picture.IsExportFormatSupported(Picture.Formats.JPEG) Then
f = SpecialFolder.Temporary.Child("TempImage.jpg")
// Save the image out to the file
ImageWell1.Image.Save(f, Picture.Formats.JPEG)
End If
// Open the file as a BinaryStream and read the data in
bs = BinaryStream.Open(f, False)
If bs <> Nil Then
imageData = bs.Read(bs.Length)
bs.Close
End If
// delete the temporary file if it exists
If f.Exists Then
f.Delete
End If
End If