CGImageSource.SetProperty
-------------------------

Sets the value for a property.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CGImageSource](component_CGImageSource.md) | [9.4](newinversion94.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "CGImageSource.SetProperty"; Ref; Index; Key; Value { ; Type } ) 

**MBS**( **"CGImageSource.SetProperty";** /\* Sets the value for a property. \*/  
**$Ref**; /\* The image source reference number returned by [CGImageSource.CreateWithData](CGImageSourceCreateWithData.md), [CGImageSource.CreateWithPath](CGImageSourceCreateWithPath.md) or [CGImageSource.CreateWithURL](CGImageSourceCreateWithURL.md) \*/   
**$Index**; /\* The index of the image to query. -1 for global properties. Else a number from 0 to [CGImageSource.Count](CGImageSourceCount.md)-1.e.g. 0 \*/   
**$Key**; /\* The property name to query.e.g. "PixelWidth" \*/   
**$Value**; /\* The value to use.  
Can be text, timestamp, boolean or number.e.g. "Hello" \*/   
**$Type**) /\* Optional; Which data type to use.  
Default is to auto to pick data type based on FileMaker data type.  
Can be "auto", "text", "number" or "array".  
For keywords, pass a list of values, which we pass as array.e.g. "text" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Ref | The image source reference number returned by [CGImageSource.CreateWithData](CGImageSourceCreateWithData.md), [CGImageSource.CreateWithPath](CGImageSourceCreateWithPath.md) or [CGImageSource.CreateWithURL](CGImageSourceCreateWithURL.md) | $ref |  |
| Index | The index of the image to query. -1 for global properties. Else a number from 0 to [CGImageSource.Count](CGImageSourceCount.md)-1. | 0 |  |
| Key | The property name to query. | "PixelWidth" |  |
| Value | The value to use.   Can be text, timestamp, boolean or number. | "Hello" |  |
| Type | Which data type to use.   Default is to auto to pick data type based on FileMaker data type.   Can be "auto", "text", "number" or "array".   For keywords, pass a list of values, which we pass as array. | "text" | Optional      Added in version **10.3**. |

### Result

Returns OK or error.

### Description

Sets the value for a property.  
You may need to use [CGImageSource.Export](CGImageSourceExport.md) to actually write an image with new metadata.  
The creation of new property dictionary is implemented for version 10.2, so you can create new sections like GPS.  
### Examples

Set keywords:

 MBS ("CGImageSource.SetProperty"; $ref ; 0; "{IPTC}.Keywords"; "First¶Second¶Third"; "Array")  
### See also

- [CGImageSource.ClearProperties](CGImageSourceClearProperties.md)
- [CGImageSource.Count](CGImageSourceCount.md)
- [CGImageSource.CreateWithData](CGImageSourceCreateWithData.md)
- [CGImageSource.CreateWithPath](CGImageSourceCreateWithPath.md)
- [CGImageSource.CreateWithURL](CGImageSourceCreateWithURL.md)
- [CGImageSource.Export](CGImageSourceExport.md)
- [CGImageSource.HasProperty](CGImageSourceHasProperty.md)
- [CGImageSource.Properties](CGImageSourceProperties.md)
- [CGImageSource.Property](CGImageSourceProperty.md)

### Release notes

- **Version 15.0**
    - Fixed a problem with [CGImageSource.SetProperty](https://www.mbsplugins.eu/CGImageSourceSetProperty.shtml) function not passing floating point numbers in automatic mode.
- **Version 10.3**
    - Added type parameter for [CGImageSource.SetProperty](https://www.mbsplugins.eu/CGImageSourceSetProperty.shtml) function.
- **Version 10.2**
    - Changed [CGImageSource.SetProperty](https://www.mbsplugins.eu/CGImageSourceSetProperty.shtml) to write new metadata dictionaries.
- **Version 9.4**
    - Added [CGImageSource.HasProperty](http://www.mbsplugins.eu/CGImageSourceHasProperty.shtml) and [CGImageSource.SetProperty](http://www.mbsplugins.eu/CGImageSourceSetProperty.shtml) to set metadata (IPTC/EXIF) and write file back.

### Example Databases

- [Mac and iOS/CGImageSource](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/CGImageSource.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 14.6pr5](https://www.mbsplugins.de/archive/2024-12-17/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.3pr5](https://www.mbsplugins.de/archive/2020-06-20/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.2pr1](https://www.mbsplugins.de/archive/2020-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Neue Funktionen des MBS FileMaker Plugin 9.4](https://www.mbsplugins.de/archive/2019-10-05/Neue_Funktionen_des_MBS_FileMa/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.4pr5](https://www.mbsplugins.de/archive/2019-09-05/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 30th August 2019 , last changed 19th June 2020

  
[CGImageSource.ReleaseAll](CGImageSourceReleaseAll.md) - [CGImageSource.Status](CGImageSourceStatus.md)

[HTML Version](CGImageSourceSetProperty.shtml)