Method

# ExportPicture

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Exports an object of type `Picture</api/graphics/picture>`.

## Usage

``` xojo
result = ExportPicture(pic)
```

| Part   | Type                               | Description                                                                                                                  |
|--------|------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| result | `Boolean</api/data_types/boolean>` | `True</api/language/true>` if the picture was saved successfully; `False</api/language/false>` if the picture was not saved. |
| pic    | `Picture</api/graphics/picture>`   | A picture.                                                                                                                   |

## Notes

When <span class="title-ref">ExportPicture</span> 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.

<span class="title-ref">ExportPicture</span> returns `True</api/language/true>` if the picture was saved; if the user clicks cancel, <span class="title-ref">ExportPicture</span> returns `False</api/language/false>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Windows

The BMP format is supported on Windows.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Macos

The jpeg and png formats are supported on macOS.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Linux

The BMP format is supported on Linux.

## Sample code

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</api/files/filetype>` class or the File Types Sets Editor in the IDE. It is referred to by the name of the object.

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

## Compatibility

|                       |         |
|-----------------------|---------|
| **Project Types**     | Desktop |
| **Operating Systems** | All     |

<div class="seealso">

`Picture</api/graphics/picture>`, `FolderItem</api/files/folderitem>` classes.

</div>
