GMImage.WriteToContainer
------------------------

Writes images as is into a container.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [GraphicsMagick](component_GraphicsMagick.md) | [9.3](newinversion93.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "GMImage.WriteToContainer"; ImageRef { ; FileName } ) 

**MBS**( **"GMImage.WriteToContainer";** /\* Writes images as is into a container. \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$FileName**) /\* Optional; File name to pass to FileMaker with container.e.g. "test.jpg" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| ImageRef | The image reference number. | 1 |  |
| FileName | File name to pass to FileMaker with container. | "test.jpg" | Optional |

### Result

Returns OK or error.

### Description

Writes images as is into a container.  
Please set type you want with [GMImage.SetMagick](GMImageSetMagick.md) function.  
Similar to other write functions, but allows you to use whatever magick type is set for codec.  
  
This function is similar to our specialized functions [GMImage.WriteToBMPContainer](GMImageWriteToBMPContainer.md), [GMImage.WriteToGIFContainer](GMImageWriteToGIFContainer.md), [GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md), [GMImage.WriteToPDFContainer](GMImageWriteToPDFContainer.md), [GMImage.WriteToPNGContainer](GMImageWriteToPNGContainer.md) and [GMImage.WriteToTiffContainer](GMImageWriteToTiffContainer.md), but you can specify the codec to use. Image is compressed and passed to FileMaker with filename. Then FileMaker (or our plugin for older FileMaker versions before 13) can detect the type from filename and generate required previews.  
  
See [Plugin.SetPreviewSize](PluginSetPreviewSize.md) to control size of preview picture.  
### Examples

Save an image as PNG:

 Set Variable \[ $BigImageRef ; Value: MBS ("[GMImage.NewFromContainer](GMImageNewFromContainer.md)"; Test::BigImage ) \]   
Set Variable \[ $Result ; Value: MBS ("[GMImage.SetMagick](GMImageSetMagick.md)"; $BigImageRef ; "PNG") \]   
Set Field \[ Test::Result ; MBS ( "GMImage.WriteToContainer"; $BigImageRef ; "test.png" ) \]   
Set Variable \[ $Error ; Value: MBS ("[GMImage.Release](GMImageRelease.md)";$BigImageRef ) \]  
### See also

- [GMImage.New](GMImageNew.md)
- [GMImage.NewFromContainer](GMImageNewFromContainer.md)
- [GMImage.ReadContainer](GMImageReadContainer.md)
- [GMImage.SetMagick](GMImageSetMagick.md)
- [GMImage.WriteToBMPContainer](GMImageWriteToBMPContainer.md)
- [GMImage.WriteToGIFContainer](GMImageWriteToGIFContainer.md)
- [GMImage.WriteToJPEGContainer](GMImageWriteToJPEGContainer.md)
- [GMImage.WriteToPDFContainer](GMImageWriteToPDFContainer.md)
- [GMImage.WriteToWebPContainer](GMImageWriteToWebPContainer.md)
- [Plugin.SetPreviewSize](PluginSetPreviewSize.md)

### Release notes

- **Version 9.3**
    - Added [GMImage.WriteToContainer](http://www.mbsplugins.eu/GMImageWriteToContainer.shtml) function.

### Blog Entries

- [MBS FileMaker Advent calendar - Door 15 - vCard QR](https://www.mbsplugins.de/archive/2024-12-15/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Tips and tricks with MBS](https://www.mbsplugins.de/archive/2023-08-10/Tips_and_tricks_with_MBS/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 18](https://www.mbsplugins.de/archive/2022-12-18/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 13](https://www.mbsplugins.de/archive/2022-12-13/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 10](https://www.mbsplugins.de/archive/2022-12-10/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 8](https://www.mbsplugins.de/archive/2022-12-08/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 7](https://www.mbsplugins.de/archive/2022-12-07/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 6](https://www.mbsplugins.de/archive/2022-12-06/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 5](https://www.mbsplugins.de/archive/2022-12-05/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)
- [GraphicsMagick in FileMaker, part 4](https://www.mbsplugins.de/archive/2022-12-04/GraphicsMagick_in_FileMaker_pa/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 20th July 2019 , last changed 4th October 2021

  
[GMImage.WriteToBMPContainer](GMImageWriteToBMPContainer.md) - [GMImage.WriteToFile](GMImageWriteToFile.md)

[HTML Version](GMImageWriteToContainer.shtml)